Closed mathe42 closed 2 years ago
Looks like a regression in Vite 3.1.5, I'll check this out
I tested this locally and it seems to be working fine. Deno 1.26.1 and macos 12.6. It might be a windows only bug 🤔 Is this happening consistently?
Yes. tried it a few times. But only with the vue template not with the vanilla template (that works)...
And running deno run -A --unstable --node-modules-dir npm:vite@3.1.4
works with no problem and deno run -A --unstable --node-modules-dir npm:vite@3.1.5
fails
My guess would be that this broke it: https://github.com/vitejs/vite/commit/dc140af
Yeah but I'm not sure how the PR broke it since tryNodeResolve('npm:@vitejs/plugin-vue')
should return undefined, and we would be returning { external: true }
like before.
I have found the location the error is thrown it is https://github.com/browserify/resolve/blob/main/lib/sync.js#L31
the function gets calld with D:\deno-vite-test2\node_modules\npm:@vitejs\plugin-vue
...
Full trace is https://github.com/vitejs/vite/blob/ecba3f8baca042d015c9285b6cb07993c67235a9/packages/vite/src/node/config.ts#L989 https://github.com/vitejs/vite/blob/ecba3f8baca042d015c9285b6cb07993c67235a9/packages/vite/src/node/plugins/resolve.ts#L653 https://github.com/vitejs/vite/blob/ecba3f8baca042d015c9285b6cb07993c67235a9/packages/vite/src/node/packages.ts#L64 https://github.com/vitejs/vite/blob/ecba3f8baca042d015c9285b6cb07993c67235a9/packages/vite/src/node/utils.ts#L146 https://github.com/browserify/resolve/blob/23a4e07530db31e14e5e47022abefa26637a1d99/lib/sync.js#L109 https://github.com/browserify/resolve/blob/23a4e07530db31e14e5e47022abefa26637a1d99/lib/sync.js#L213 https://github.com/browserify/resolve/blob/23a4e07530db31e14e5e47022abefa26637a1d99/lib/sync.js#L31
Wow thanks @mathe42 that's really helpful! I suppose Vite would need to skip or interpret npm:
for now, looks like Vite is not resolving it right.
System
Windows 10 deno 1.26.1
Reproduction
deno run -A --unstable npm:create-vite-extra
deno task dev
Full logs:
Additional Info
Not sure if this is a bug with create-vite-extra or denos npm implementation etc. I'm happy to create an issue upstream where needed....