bluwy/create-vite-extra

bug: [plugin externalize-deps] EINVAL: invalid argument, stat

mathe42 opened this issue · 10 comments

System

Windows 10
deno 1.26.1

Reproduction

  1. deno run -A --unstable npm:create-vite-extra
  2. select deno-vue
  3. cd into folder
  4. 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....

bluwy commented

Looks like a regression in Vite 3.1.5, I'll check this out

bluwy commented

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: vitejs/vite@dc140af

bluwy commented

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...

bluwy commented

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.