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

Vite 6 regression on resolving the imports of npm packages #18864

Closed
7 tasks done
brillout opened this issue Dec 2, 2024 · 2 comments
Closed
7 tasks done

Vite 6 regression on resolving the imports of npm packages #18864

brillout opened this issue Dec 2, 2024 · 2 comments

Comments

@brillout
Copy link
Contributor

brillout commented Dec 2, 2024

Describe the bug

It seems that Vite doesn't use the right package.json#exports names:

~/code/telefunc/examples/authentication (brillout/vite-6|u=) pnpm run dev

> @ dev /home/rom/code/telefunc/examples/authentication
> npm run server


> server
> vite

  VITE v6.0.2  ready in 789 ms
  ➜  press h + enter to show help
Server running at http://localhost:3000
✘ [ERROR] No known conditions for "./stringify" specifier in "@brillout/json-serializer" package [plugin vite:dep-pre-bundle]

    ../../telefunc/dist/cjs/node/server/runTelefunc/serializeTelefunctionResult.js:4:28:
      4 │ const stringify_1 = require("@brillout/json-serializer/stringify");
        ╵                             ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

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

    ../../node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1150:20:
      1150 │       let promise = setup({
           ╵                     ^

    at setup (file:///home/rom/code/telefunc/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-A4nAWF7x.js:16602:13)
    at handlePlugins (/home/rom/code/telefunc/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1150:21)
    at buildOrContextImpl (/home/rom/code/telefunc/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:873:5)
    at Object.buildOrContext (/home/rom/code/telefunc/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:699:5)
    at /home/rom/code/telefunc/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:2037:68
    at new Promise (<anonymous>)
    at Object.context (/home/rom/code/telefunc/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:2037:27)
    at Object.context (/home/rom/code/telefunc/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1879:58)
    at prepareEsbuildOptimizerRun (file:///home/rom/code/telefunc/node_modules/.pnpm/[email protected]_@[email protected][email protected][email protected]/node_modules/vite/dist/node/chunks/dep-A4nAWF7x.js:18794:33)

Reproduction

brillout/telefunc#130

Steps to reproduce

git clone [email protected]:brillout/telefunc
cd telefunc/
git checkout brillout/vite-6
pnpm install
pnpm run build
cd examples/authentication/
pnpm run dev

Same as single line (copy & paste me):

git clone [email protected]:brillout/telefunc && cd telefunc/ && git checkout brillout/vite-6 && pnpm install && pnpm run build && cd examples/authentication/ && pnpm run dev

System Info

System:
    OS: Linux 6.8 Ubuntu 24.04.1 LTS 24.04.1 LTS (Noble Numbat)
    CPU: (8) x64 Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
    Memory: 3.10 GB / 7.52 GB
    Container: Yes
    Shell: 5.2.21 - /bin/bash
  Binaries:
    Node: 20.12.2 - ~/.nix-profile/bin/node
    Yarn: 1.22.22 - ~/.nix-profile/bin/yarn
    npm: 10.5.0 - ~/.nix-profile/bin/npm
    pnpm: 9.6.0 - ~/.local/share/pnpm/pnpm
    bun: 1.1.24 - ~/.bun/bin/bun
    Watchman: 2024.03.11.00 - /home/rom/.nix-profile/bin/watchman
  Browsers:
    Chrome: 131.0.6778.85
  npmPackages:
    @vitejs/plugin-react: ^4.3.4 => 4.3.4 
    vite: ^6.0.2 => 6.0.2

Used Package Manager

pnpm

Logs

No response

Validations

@sapphi-red
Copy link
Member

@brillout
Copy link
Contributor Author

brillout commented Dec 3, 2024

Indeed, that was the culprit. Thank you sapphi-red. (It's a great change btw.)

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

No branches or pull requests

2 participants