-
-
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
ESM depedencies with CJS sub-dependencies break the dev server #9220
Comments
The built code works properly. If proptypes was a direct dependency it also works properly. 👀 |
The issue is that Closing as this is a variation of #3910. It should be fixed once I figure out #6801 for plugin-react. |
What do you mean when you say it would be resorted to a react plugin instead? I was under the impression the JSX would be transformed during prebundling. This would allow authors to publish source code and allow their build pipeline to bundle more efficiently? If we compile the jsx to js with vite in library mode, wouldn't that create duplicate code and an increased bundle? |
Yeah JSX, and other like Vue and Svelte are ignored currently as esbuild can't process them. For JSX & esbuild though, the codebase comments say it's to prevent ambiguity between esbuild and plguin-react handling (im not familiar with react in general). Compiling it shouldn't duplicate the code, as long as you externalized |
I also saw such error messages when using ant-design-vue in a nuxt3 project, are they the same problem? https://github.com/nuxt/framework/discussions/5940#discussioncomment-3194207 |
I'm not sure why |
Describe the bug
When I attempt to run an app in development mode that has an ES Module dependency (
@ugrc/sherlock
) that, in turn, has a CommonJS dependency (prop-types
), the dev server throws the following error:The workaround is to include the CJS sub-dependencies in the
optimizeDeps.include
config but this becomes very tedious.I'm not sure if this is a bug or intended functionality. I also wasn't sure if this was an upstream issue with esbuild.
Reproduction
https://stackblitz.com/edit/vitejs-vite-df3gjm
System Info
Used Package Manager
npm
Logs
Click to expand!
Validations
The text was updated successfully, but these errors were encountered: