-
-
Notifications
You must be signed in to change notification settings - Fork 6.5k
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
Yarn 2/PnP - optimizeDeps not work after esbuil handle it #1688
Comments
AFAIK it's a known limitation of esbuild: evanw/esbuild#154 I suspect this means Vite 2 simply can't support Yarn 2 pnp. We've actually had various issues with it in the past because how hacky its module resolution is, so I think this is it.
|
Maybe you could add a custom plugin option directly to esbuild, so we can add our plugin something like this:
Detailed information about how it works : evanw/esbuild#237 |
It would make the pre-bundling significantly slower because the fs read is now performed in Node and then has to be passed back to the esbuild Go process, creating non-trivial overhead. Or we'll have to manually detect Yarn pnp and inject this plugin. So technically I guess this can work, but honestly I just don't understand why people even use Yarn 2. It just creates more problems than it solves compared to pnpm. |
Should work after 028c3bb - although I still wouldn't recommend using Yarn 2 pnp with Vite. |
We use it cause it has outstanding monorepo support for a very large project (multi thread build, complete workspace linking etc) also it's support offline install so the CI doesn't need to download the deps over and over again so the build time much slower, also the deps never broken cause minor update or network issue. I know all the previous can be solvable other ways or tools but it is much out of the box than other. By the way thx for the quick fix. |
Yarn 1 and pnpm both have complete monorepo support. And if you cache your installed deps on CI + install with |
Describe the bug
When developing with Yarn 2 (PnP) vite not start in dev mode. Esbuild throws an error when try to read the node_modules deps.
Reproduction
npm i -g yarn
)npm init @vitejs/app my-vue-app --template react
cd my-vue-app
yarn set version berry
yarn init
yarn add -D vite @vitejs/plugin-react-refresh
yarn add jquery
)import $ from "jquery"
)"dev": "vite"
System Info
vite
version: 2.0.0-beta.46Logs (Optional if provided reproduction)
The text was updated successfully, but these errors were encountered: