-
Notifications
You must be signed in to change notification settings - Fork 65
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Having issues with slow responses with nuxi dev
#209
Comments
dev
and default host?nuxi dev
Hi @pi0 Win hosts
wsl --version
No WSL2 lsb_release -a
WSL2 etc/hosts
VS Code
VS Code .devcontainer lsb_release -a
npx nuxi info
|
Thanks for info @or2e. Are you available for a quick call so i can check your project ? (You can reach me out both via discord and [email protected]) Also, is it slow if you use nuxi dev |
Hey @pi0, My small website is now taking 10~mins to build.
I'm happy to provide more information here if you need it. |
@blowsie first you might want to upgrade your CLI to 3.9.x |
Thanks @manniL, I get the same results with 3.9
|
After upgrading CLI to 3.9.0, slower is resolved for me (on WSL2), but it break my implementation of websocket. an issue solved by bringing 3 more... 😒 |
Thanks to more info @stafyniaksacha, there seems to be ~10% overhead in WSL environments from proxy. Meanwhile working on a fix (to use direct IPX Sockets), you might try with @Dodobibi Sorry to hear that. Currently, we do not have any official way of registering WebSockets but this example might be helpful (and works with all versions of CLI listen hook. Feel free to open an issue with your current code if can't make it would be happy to help. |
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
This comment was marked as off-topic.
No any progress. Old version: Still slow new version: The same data, the same site. |
@vladimir-pankov can you please share |
I do not know dependencies but nitro prints big execution time: [nitro] ├─ /api/_content/query/k9iRHwiJVs.1695315995949.json (9468ms) in comparison to old version: |
The fixes in CLI verison 3.9.0 solved the problem for me. For new projects it works immediately ( My previous project, which I had to run with So the slow loading is resolved for me. @vladimir_pankov make sure to remove yarn.lock in your project, as nuxi is also cached there and run a fresh yarn install to get cli version 3.9.0 in your project |
@luke-z |
same here with CLI version 3.9.0
|
Same here, but in Windows don't use WSL
|
nuxi dev (even with 3.9.0 version) on Windows 11 and Nodejs 20+ is starting the app very slowly. Here are the timestamps: $ nuxi dev
Nuxt 3.7.4 with Nitro 2.6.3 11:04:29 pm
11:04:31 pm
➜ Local: http://localhost:3000/
➜ Network: use --host to expose
ℹ Compiled templates.pwa.client.28cc0ab3.ts in 6876.59ms 11:05:24 pm
ℹ Compiled routes.mjs in 7994.6ms 11:05:25 pm
ℹ Compiled types/imports.d.ts in 8388.91ms 11:05:25 pm
ℹ Compiled plugins/server.mjs in 11460.16ms 11:05:28 pm
ℹ Compiled plugins/client.mjs in 11774.8ms 11:05:28 pm
ℹ Vite client warmed up in 146844ms 11:08:14 pm
✔ Nitro built in 192071 ms nitro 11:11:12 pm Here is the nuxi info: ------------------------------
- Operating System: Windows_NT
- Node Version: v20.8.0
- Nuxt Version: 3.7.4
- CLI Version: 3.9.0
- Nitro Version: 2.6.3
- Package Manager: [email protected]
- Builder: -
- User Config: css, devtools, experimental, nitro, modules, postcss, pwa, routeRules, runtimeConfig
- Runtime Modules: @vueuse/[email protected], @bg-dev/[email protected], @pinia/[email protected], @pinia-plugin-persistedstate/[email protected], @vite-pwa/[email protected]
- Build Modules: -
------------------------------ Nuxt configHere is my nuxt config file// https://nuxt.com/docs/api/configuration/nuxt-config
export default defineNuxtConfig({
css: [
'~/assets/style/main.css',
],
devtools: { enabled: false /* process.dev */ },
experimental: {
// writeEarlyHints: false,
},
nitro: {
experimental: {
asyncContext: true
},
preset: 'firebase',
firebase: {
gen: 2,
httpsOptions: {
region: 'asia-south1',
maxInstances: 2,
},
},
},
modules: [
'@vueuse/nuxt',
'@bg-dev/nuxt-naiveui',
'@pinia/nuxt',
'@pinia-plugin-persistedstate/nuxt',
'@vite-pwa/nuxt',
],
postcss: {
plugins: {
'postcss-import': {},
'tailwindcss/nesting': {},
tailwindcss: {},
autoprefixer: {},
},
},
pwa: {
registerType: 'autoUpdate',
manifest: {
name: '... ...',
short_name: '...',
theme_color: '#ffffff',
icons: [/* ... */],
start_url: '/start',
},
workbox: {
navigateFallback: '/',
globPatterns: ['**/*.{js,css,html,png,svg,ico}'],
},
client: {
installPrompt: true,
// you don't need to include this: only for testing purposes
// if enabling periodic sync for update use 1 hour or so (periodicSyncForUpdates: 3600)
// periodicSyncForUpdates: 20,
},
devOptions: {
enabled: true,
// suppressWarnings: true,
navigateFallbackAllowlist: [/^\/$/],
type: 'module',
},
},
routeRules: {
'/': { swr: 3600 * 2 },
'/about/**': { static: true },
'/api/**': { cors: true },
'/blog/**': { static: true },
'/legal/**': { static: true },
'/pricing/**': { static: true },
'/research/**': { swr: 3600 * 15 },
'/settings/**': { swr: 3600 * 15 },
'/support/**': { static: true },
},
runtimeConfig: {
public: {
naiveui: {
colorModePreference: 'dark',
}
}
}
}) Tailwind configAnd here is my tailwind config file/** @type {import('tailwindcss').Config} */
const { iconsPlugin, getIconCollections } = require("@egoist/tailwindcss-icons")
module.exports = {
content: [
"./app.vue",
"./components/**/*.{js,vue,ts}",
"./content/**/*.{js,vue,ts,md,yaml,json}",
"./modules/**/*.{js,ts}",
"./layouts/**/*.vue",
"./pages/**/*.vue",
"./plugins/**/*.{js,ts}",
"./app.config.{js,ts}",
"./nuxt.config.{js,ts}",
],
darkMode: 'class',
theme: {
extend: {},
},
plugins: [
iconsPlugin({
collections: getIconCollections(["mdi", "lucide", "solar", "heroicons", "twemoji"]),
}),
]
} Edit: Removing modules (except pwa)With this in nuxt config modules: [
// '@vueuse/nuxt',
// '@bg-dev/nuxt-naiveui',
// '@pinia/nuxt',
// '@pinia-plugin-persistedstate/nuxt',
'@vite-pwa/nuxt',
], Still, the timestamps hardly show any improvement $ nuxi dev
Nuxt 3.7.4 with Nitro 2.6.3 11:28:44 pm
11:28:45 pm
➜ Local: http://localhost:3000/
➜ Network: use --host to expose
✔ Nitro built in 23524 ms nitro 11:30:32 pm
ℹ Vite client warmed up in 120897ms 11:30:57 pm Edit: Cleaning the entire nuxt config fileNuxt config file: export default defineNuxtConfig({}) The timestamps improved, but still, aren't they quite high? $ nuxi dev
Nuxt 3.7.4 with Nitro 2.6.3 11:35:54 pm
11:35:55 pm
➜ Local: http://localhost:3000/
➜ Network: use --host to expose
ℹ Vite client warmed up in 74802ms 11:37:16 pm
✔ Nitro built in 19298 ms nitro 11:37:21 pm Keeping the nuxt config file clean, I downgraded the Nuxt to 3.7.1 and Nitropack to 2.6.2. Here are the improved timestamps: $ nuxi dev
Nuxt 3.7.1 with Nitro 2.6.2 12:13:03 am
12:13:04 am
➜ Local: http://localhost:3000/
➜ Network: use --host to expose
ℹ Vite client warmed up in 62607ms 12:14:14 am
✔ Nitro built in 16830 ms nitro 12:14:19 am |
@pi0 Anything new on this issue ? :) |
Thanks for investigation! For me, build times are always fast (using without with
|
I am having massive performance issues (nuxt/nuxt#23504) - what is the trick with --host? 🤔
|
There are scenarios when its not possible to remove the custom Are there any plans to resolve the issue so that there's no slowdown even with a custom HOST set? |
We are experiencing this with WSL2, does not happen on macOS, setting We require the ability to bind to 0.0.0.0 for testing on other devices on the network, so not setting this is not an option. Currently, we're using an env variable to set the |
Starting with the
3.7.0
release of the nuxi CLI, we added a security fix to prevent exposing the dev server port to the local-area network by default, limiting its access to your computer only.Initially, using
127.0.0.1
as a localhost IP address tended to work fine on MacOS and Linux operating systems. However, we soon received bug reports indicating that it caused slower builds on Windows, Docker, and WSL2. The reason is thatlocalhost
can be resolved to either127.0.0.1
(IPv4) or::1
(IPv6), and on some operating systems, they first attempt to use IPv6 (::1
) each time. This behavior was not available, and a timeout occurred before falling back to127.0.0.1
, causing slow build issues.In the latest release of nuxi 3.9 and unjs/listhen via unjs/listhen#126, we have adjusted the defaults to better support Windows, WSL2, and Docker. At least in my homelab Windows VM, it now shows fast builds again when using the default nuxi host and opening it in
http://localhost:3000
.If you were previously using any workarounds involving the
--host
argument orHOST
environment variable, please consider removing them and trying again.You can update to the latest version of nuxi by using
nuxi upgrade
, or you can try it withnpx nuxi@latest dev
orbun x nuxi@latest dev
. You can ensure you have the latest version by using thenuxi info
ornuxi --version
commands.If you continue to experience slow build issues, they may have different causes. In this case, further investigation is necessary.
Please report the issue in this thread along with the full output of the
nuxi info
command, including your local host information. Also, mention if you are using WSL2 or any custom setup.The text was updated successfully, but these errors were encountered: