Skip to content
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

Alias and node next module resolution results in dep scan error of a typescript file import in a vue SFC #9198

Closed
7 tasks done
kalvenschraut opened this issue Jul 18, 2022 · 0 comments · Fixed by #9282
Closed
7 tasks done

Comments

@kalvenschraut
Copy link

kalvenschraut commented Jul 18, 2022

Describe the bug

With typescript module resolution set to node next, need to import typescript files with the js extension. This seems to behave fine in normal typescript files, but when combined with an alias and inside a vue component I am receiving a vite:dep-scan error being unable to find the file since it is looking for the js file instead of the typescript one. i.e. (src/Foo.js instead of src/Foo.ts). Note this only happens on a cold start and not entirely sure if it is breaking anything besides showing the error

Reproduction

https://github.com/RtVision/vite3-alias-dep-scan-repro

System Info

System:
    OS: Linux 5.15 Gentoo Linux
    CPU: (4) x64 Intel(R) Core(TM) i5-6500 CPU @ 3.20GHz
    Memory: 9.48 GB / 17.24 GB
    Container: Yes
    Shell: 5.1.16 - /bin/bash
  Binaries:
    Node: 16.14.2 - /usr/bin/node
    Yarn: 1.22.18 - ~/.local/share/pnpm/yarn
    npm: 8.13.2 - /usr/bin/npm
    Watchman: 2022.03.28.00 - /usr/bin/watchman
  Browsers:
    Firefox: 91.10.0esr
  npmPackages:
    @vitejs/plugin-vue: ^3.0.0 => 3.0.1
    vite: ^3.0.0 => 3.0.2

Used Package Manager

pnpm

Logs

[ERROR] [plugin vite:dep-scan] ENOENT: no such file or directory, open '/home/kalvens/open-source/vite-vue-nodenext-resolution/src/composables/Test.js'

node_modules/.pnpm/esbuild@0.14.49/node_modules/esbuild/lib/main.js:981:33:
  981 │               let result = await callback2({
      _                                  ^

at Object.openSync (node:fs:585:3)
at Object.readFileSync (node:fs:453:35)
at file:///home/kalvens/open-source/vite-vue-nodenext-resolution/node_modules/.pnpm/vite@3.0.2_sass@1.53.0/node_modules/vite/dist/node/chunks/dep-1513d487.js:36073:37
at callback (/home/kalvens/open-source/vite-vue-nodenext-resolution/node_modules/.pnpm/esbuild@0.14.49/node_modules/esbuild/lib/main.js:981:34)
at handleRequest (/home/kalvens/open-source/vite-vue-nodenext-resolution/node_modules/.pnpm/esbuild@0.14.49/node_modules/esbuild/lib/main.js:709:36)
at handleIncomingPacket (/home/kalvens/open-source/vite-vue-nodenext-resolution/node_modules/.pnpm/esbuild@0.14.49/node_modules/esbuild/lib/main.js:756:7)
at Socket.readFromStdout (/home/kalvens/open-source/vite-vue-nodenext-resolution/node_modules/.pnpm/esbuild@0.14.49/node_modules/esbuild/lib/main.js:632:7)
at Socket.emit (node:events:526:28)
at addChunk (node:internal/streams/readable:315:12)
at readableAddChunk (node:internal/streams/readable:289:9)

This error came from the "onLoad" callback registered here:

node_modules/.pnpm/esbuild@0.14.49/node_modules/esbuild/lib/main.js:843:22:
  843 │         let promise = setup({
      _                       ^

at setup (file:///home/kalvens/open-source/vite-vue-nodenext-resolution/node_modules/.pnpm/vite@3.0.2_sass@1.53.0/node_modules/vite/dist/node/chunks/dep-1513d487.js:36069:19)
at handlePlugins (/home/kalvens/open-source/vite-vue-nodenext-resolution/node_modules/.pnpm/esbuild@0.14.49/node_modules/esbuild/lib/main.js:843:23)
at Object.buildOrServe (/home/kalvens/open-source/vite-vue-nodenext-resolution/node_modules/.pnpm/esbuild@0.14.49/node_modules/esbuild/lib/main.js:1137:7)
at /home/kalvens/open-source/vite-vue-nodenext-resolution/node_modules/.pnpm/esbuild@0.14.49/node_modules/esbuild/lib/main.js:2085:17
at new Promise (<anonymous>)
at Object.build (/home/kalvens/open-source/vite-vue-nodenext-resolution/node_modules/.pnpm/esbuild@0.14.49/node_modules/esbuild/lib/main.js:2084:14)
at build (/home/kalvens/open-source/vite-vue-nodenext-resolution/node_modules/.pnpm/esbuild@0.14.49/node_modules/esbuild/lib/main.js:1931:51)
at file:///home/kalvens/open-source/vite-vue-nodenext-resolution/node_modules/.pnpm/vite@3.0.2_sass@1.53.0/node_modules/vite/dist/node/chunks/dep-1513d487.js:35773:46
at Array.map (<anonymous>)

The plugin "vite:dep-scan" was triggered by this import

script:/home/kalvens/open-source/vite-vue-nodenext-resolution/src/App.vue?id=0:6:17:
  6 │ import Test from "@/composables/Test.js";
    _                  ~~~~~~~~~~~~~~~~~~~~~~~

Build failed with 1 error:
node_modules/.pnpm/esbuild@0.14.49/node_modules/esbuild/lib/main.js:981:33: ERROR: [plugin: vite:dep-scan] ENOENT: no such file or directory, open '/home/kalvens/open-source/vite-vue-nodenext-resolution/src/composables/Test.js'

Validations

@github-actions github-actions bot locked and limited conversation to collaborators Aug 5, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant