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

Whether or not module is pre-bundled is highly sensitive to workspace dependencies #17311

Closed
7 tasks done
jsimonrichard opened this issue May 25, 2024 · 3 comments
Closed
7 tasks done

Comments

@jsimonrichard
Copy link

Describe the bug

I'm working on a project with the @modular-forms/solid package, which is an ESM module, so I would expect it to not be pre-bundled. However, it's pre-bundled when the following are true (I think).

  • The project is a node monorepo
  • The package inside the monorepo (package_a in my case) does not have the dependencies listed in it's own package.json; they're listed in the monorepo package.json instead.
  • You're using bun. If you use npm, it won't be able to find the right dependencies for some reason.
  • There may be other requirements, but I'm not sure.

This normally wouldn't be a problem, but it contributed to this issue: #17310.

Reproduction

https://github.com/jsimonrichard/vite-pre-bundling-issues-mre

Steps to reproduce

cd wrongly-pre-bundled/package_a
bun i
bun start

Then stop the program and inspect wrongly-pre-bundled/node_modules/.vite. The pre-bundled file for @modular-forms/solid should be present.

System Info

System:
    OS: Linux 6.2 Ubuntu 22.04.3 LTS 22.04.3 LTS (Jammy Jellyfish)
    CPU: (24) x64 AMD Ryzen Threadripper 1920X 12-Core Processor
    Memory: 44.94 GB / 62.64 GB
    Container: Yes
    Shell: 5.8.1 - /usr/bin/zsh
  Binaries:
    Node: 21.6.1 - ~/.nvm/versions/node/v21.6.1/bin/node
    npm: 10.2.4 - ~/.nvm/versions/node/v21.6.1/bin/npm
    bun: 1.1.8 - ~/.bun/bin/bun
  Browsers:
    Brave Browser: 123.1.64.113
    Chromium: 125.0.6422.60

Used Package Manager

bun

Logs

No response

Validations

@hi-ogawa
Copy link
Collaborator

  • You're using bun. If you use npm, it won't be able to find the right dependencies for some reason.

I'm not familiar with npm workspace features, but maybe the difference is just you forgot to run npm i inside cd wrongly-pre-bundled. It looks like npm i inside cd wrongly-pre-bundled/package_a is not enough for npm.

Other than that, the behavior looks same and the issue is essentially #17310. Can you confirm?

@jsimonrichard
Copy link
Author

You're right; if I run npm i inside wrongly-pre-bundled/ then npm start inside wrongly-pre-bundled/package_a/, npm works fine. The package @modular-forms/solid is still pre-bundled, but if that's the expected behavior then feel free to close this issue.

The main issue is #17310.

@hi-ogawa
Copy link
Collaborator

Yeah, I think this one is simply a difference of npm i and bun i inside individual workspace directory, so it's not related to Vite. Closing.

@github-actions github-actions bot locked and limited conversation to collaborators Jun 10, 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