Open pi0 opened 1 year ago
Hi @pi0 the problem keeps reproducing, just in case I reinstalled win and wsl )
No C:\Users\<UserName>\.wslconfig
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 pooya@pi0.io)
Also, is it slow if you use nuxi dev --no-fork
?
Hey @pi0,
My small website is now taking 10~mins to build.
------------------------------
- Operating System: Windows_NT
- Node Version: v20.7.0
- Nuxt Version: 3.7.3
- CLI Version: 3.8.4
- Nitro Version: 2.6.3
- Package Manager: pnpm@8.6.2
- Builder: -
- User Config: runtimeConfig, experimental, modules, pinia, eslint, imports, components, tailwindcss, css, app, devtools, build
- Runtime Modules: @oen.web.vue/ui/nuxt@1.5.0, @nuxtjs/tailwindcss@6.8.0, @pinia/nuxt@0.4.11,
@pinia-plugin-persistedstate/nuxt@1.1.2, @nuxt/content@2.8.2, @vueuse/nuxt@10.4.1, ./nuxt-webshop-api/src/module
- Build Modules: -
------------------------------
I'm happy to provide more information here if you need it.
Alternatively, we can chat in discord if it helps.
My handle blowsie.dev
@blowsie first you might want to upgrade your CLI to 3.9.x
Thanks @manniL, I get the same results with 3.9
------------------------------
- Operating System: Windows_NT
- Node Version: v20.3.0
- Nuxt Version: 3.7.3
- CLI Version: 3.9.0
- Nitro Version: 2.6.3
- Package Manager: pnpm@8.6.2
- Builder: -
- User Config: modules, pinia, eslint, imports, components, tailwindcss, css, app, devtools, build, routeRules
- Runtime Modules: @oen.web.vue/ui/nuxt@1.5.0, @nuxtjs/tailwindcss@6.8.0, @pinia/nuxt@0.4.11, @pinia-plugin-persistedstate/nuxt@1.1.2, @nuxt/content@2.8.2, @vueuse/nuxt@10.4.1
- Build Modules: -
------------------------------
nuxt dev
Nuxt 3.7.3 with Nitro 2.6.3 13:01:33 13:01:36 ➜ Local: http://localhost:3000/ ➜ Network: use --host to expose
i Using default Tailwind CSS file nuxt:tailwindcss 13:01:51 √ Nuxt DevTools is enabled v0.8.4 (experimental) 13:02:01
WARN Slow module @nuxt/devtools took 7926.15ms to setup. 13:02:01
i Tailwind Viewer: http://localhost:3000/_tailwind/ nuxt:tailwindcss 13:02:02 i ✨ optimized dependencies changed. reloading 13:03:26 i Vite client warmed up in 110871ms 13:03:58 √ Nitro built in 162235 ms
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... :unamused:
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 nuxi dev --no-fork
.
@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.
@pi0, thanks, but this example is bad for me, because in your example, the websocket server is running in a build context, when it should be running in an execution context (not on the same worker ). To do this, I create a ws server into a nuxtNitroPlugin, and a proxy in a module. It's broken now. I'm looking forward to a real official websocket implementation.
@Dodobibi If it was working before, it shouldn't be broken. So feel free to open issue in meanwhile (marking our messages as off-topic here)
No any progress. Old version: Nuxi 3.6.5 Nuxt 3.6.5 with Nitro 2.6.0 Done in 426.59s.
Still slow new version: Nuxt 3.7.3 with Nitro 2.6.3 Done in 3661.96s.
The same data, the same site.
@vladimir-pankov can you please share nuxi info
output? 🙏🏼
I do not know dependencies but nitro prints big execution time:
[nitro] ├─ /api/_content/query/k9iRHwiJVs.1695315995949.json (9468ms) [nitro] ├─ /api/_content/query/465KpVz6lY.1695315995949.json (9469ms) [nitro] ├─ /api/_content/query/B8SbwC8dv3.1695315995949.json (9243ms) [nitro] ├─ /api/_content/query/LXc88yZOr0.1695315995949.json (8346ms) [nitro] ├─ /api/_content/query/zPiQGDJdIf.1695315995949.json (8345ms) [nitro] ├─ /api/_content/query/rxDcFyI10a.1695315995949.json (8346ms)
in comparison to old version: [nitro] ├─ /api/_content/query/tF9pmSdcSG.1695310283789.json (216ms) [nitro] ├─ /api/_content/query/NBBzC05jLl.1695310283789.json (204ms) [nitro] ├─ /api/_content/query/W0UzeWBvuu.1695310283789.json (203ms) [nitro] ├─ /api/_content/query/Gg6BrmZ1bO.1695310283789.json (232ms) [nitro] ├─ /api/_content/query/UHnxKwnROu.1695310283789.json (213ms) [nitro] ├─ /api/_content/query/h2C4aJKlkf.1695310283789.json (213ms)
The fixes in CLI verison 3.9.0 solved the problem for me.
For new projects it works immediately (npx nuxi@latest init my-app
)
My previous project, which I had to run with nuxt dev --host
, worked after running yarn nuxi upgrade --force
I also tried just removing node_modules/ and yarn.lock, which did the trick as well.
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 That was i did to meet this problem ( removing yarn.lock ) I've tested with cli version 3.9.0 and no progress ( still slow ). My project uses SSG mode and so generation repeats for each route ( 2665 times ) I guess that dev or init modes do not suit my case.
same here with CLI version 3.9.0
------------------------------
- Operating System: Linux
- Node Version: v18.15.0
- Nuxt Version: 3.7.0
- CLI Version: 3.9.0
- Nitro Version: 2.6.3
- Package Manager: pnpm@8.1.1
- Builder: -
- User Config: app, vite, hooks, css, components, modules, pinia, viewport
- Runtime Modules: @pinia/nuxt@0.4.6, @nuxtjs/tailwindcss@6.3.1, @nuxt/image-edge@1.0.0-27954023.4cee565, @vueuse/nuxt@10.4.1, @pinia/nuxt@0.4.6, nuxt-viewport@2.0.3, vue-types-nuxt@1.0.0, @pinia-plugin-persistedstate/nuxt@1.1.1
- Build Modules: -
------------------------------
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: npm@10.1.0
- Builder: -
- User Config: css, devtools, experimental, nitro, modules, postcss, pwa, routeRules, runtimeConfig
- Runtime Modules: @vueuse/nuxt@10.4.1, @bg-dev/nuxt-naiveui@1.4.7, @pinia/nuxt@0.4.11, @pinia-plugin-persistedstate/nuxt@1.1.2, @vite-pwa/nuxt@0.1.1
- Build Modules: -
------------------------------
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
Nuxt 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 ssr: true
)
however, downloading files (js/css/vue) is very slow on localhost
without --host
(which is default setup).
without --host
:
localhost: 300ms/file (>1minute page refresh in total for not-so-big project)
127.0.0.1: 10ms/file
with --host
:
localhost: 10ms/file
127.0.0.1: 10ms/file
------------------------------
- Operating System: Windows_NT
- Node Version: v18.9.0
- Nuxt Version: 3.7.4
- CLI Version: 3.9.0
- Nitro Version: 2.6.3
- Package Manager: pnpm@8.6.5
- Builder: -
- User Config: ssr, srcDir, serverDir, modules, routeRules, pwa, spaLoadingTemplate, app, nitro, imports, css, vite, hooks
- Runtime Modules: nuxt-vitest@0.7.1, @vite-pwa/nuxt@0.1.1, ()
- Build Modules: -
------------------------------
I am having massive performance issues (https://github.com/nuxt/nuxt/issues/23504) - what is the trick with --host? 🤔
------------------------------
- Operating System: Windows_NT
- Node Version: v18.17.1
- Nuxt Version: 3.7.4
- CLI Version: 3.9.0
- Nitro Version: 2.6.3
- Package Manager: yarn@1.22.19
- Builder: -
- User Config: telemetry, devtools, components, app, nitro, vite, css, modules, proxy, runtimeConfig
- Runtime Modules: @vueuse/nuxt@10.4.1, @pinia/nuxt@0.4.11, nuxt-jsonld@2.0.8, @nuxt-alt/proxy@2.3.2
- Build Modules: -
------------------------------
There are scenarios when its not possible to remove the custom HOST
env var. I'm in a project that has a fairly custom local dev env involving local kubernetes, and for that to work on WSL2, HOST must be set to 127.0.0.1.
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 devServer.host
to anything besides null triggers the slow loading behavior.
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 host
, but it's not ideal as this still means WSL systems are not able to debug over the network - just that we don't need to modify the nuxt config and can override the host for macOS devs and testing over the network
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 https://github.com/unjs/listhen/pull/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.