bug: [plugin externalize-deps] EINVAL: invalid argument, stat
mathe42 opened this issue · 10 comments
System
Windows 10
deno 1.26.1
Reproduction
deno run -A --unstable npm:create-vite-extra
- select deno-vue
- cd into folder
- run
deno task dev
Full logs:
Warning deno task is unstable and may drastically change in the future
Task dev deno run -A --unstable --node-modules-dir npm:vite
✘ [ERROR] [plugin externalize-deps] EINVAL: invalid argument, stat
vite.config.mjs:2:16:
2 │ import vue from 'npm:@vitejs/plugin-vue'
╵ ~~~~~~~~~~~~~~~~~~~~~~~~
failed to load config from D:\deno-vite-test2\vite.config.mjs
error when starting dev server:
Error: Build failed with 1 error:
vite.config.mjs:2:16: ERROR: [plugin: externalize-deps] EINVAL: invalid argument, stat
at failureErrorWithLog (file:///D:/deno-vite-test2/node_modules/.deno/esbuild@0.15.10/node_modules/esbuild/lib/main.js:1566:15)
at file:///D:/deno-vite-test2/node_modules/.deno/esbuild@0.15.10/node_modules/esbuild/lib/main.js:1024:28
at runOnEndCallbacks (file:///D:/deno-vite-test2/node_modules/.deno/esbuild@0.15.10/node_modules/esbuild/lib/main.js:1438:61)
at buildResponseToResult (file:///D:/deno-vite-test2/node_modules/.deno/esbuild@0.15.10/node_modules/esbuild/lib/main.js:1022:7)
at file:///D:/deno-vite-test2/node_modules/.deno/esbuild@0.15.10/node_modules/esbuild/lib/main.js:1134:14
at responseCallbacks.<computed> (file:///D:/deno-vite-test2/node_modules/.deno/esbuild@0.15.10/node_modules/esbuild/lib/main.js:671:9)
at handleIncomingPacket (file:///D:/deno-vite-test2/node_modules/.deno/esbuild@0.15.10/node_modules/esbuild/lib/main.js:726:9)
at w.readFromStdout (file:///D:/deno-vite-test2/node_modules/.deno/esbuild@0.15.10/node_modules/esbuild/lib/main.js:647:7)
at w.emit (https://deno.land/std@0.159.0/node/_events.mjs:379:28)
at ot (https://deno.land/std@0.159.0/node/_stream.mjs:10:32715)
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....
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
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: vitejs/vite@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.
Fixed by vitejs/vite#10446