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
Dev(or serve) mode doesn't compatible with amd format. #16511
Labels
Comments
Start a new pull request in StackBlitz Codeflow. |
FoxDaxian
changed the title
Dev(or serve) mode can not compatible with amd format.
Dev(or serve) mode doesn't compatible with amd format.
Apr 23, 2024
This is in direct conflict with Vite's philosophy, so I don't think it will be implemented. But probably you would be able to swap ESM with SystemJS modules when #16471 lands. Although it would require quite a effort. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Describe the bug
Use system0.21.6 to load main.jsx instead use type:module to load, shown as below:
Then use
@babel/plugin-transform-modules-amd
to transform source files so that SystemJS.import can work, shown as below:Inspect page, what main.jsx shows is:
You can see except React an React-DOM which we can inject into html manually or automatically, and use
SystemJS.register
to initialize them. we have another dependence, named./App.jsx
, that means if we have 5 dependencies. we need useSystemJS.register
to register them one by one. that's not what I want.So I think Vite should bundle all code of
src folder
into to one single file(maybe main.jsx) when serve mode.Hope can get your responses as soon as possible.
Best regards.
Reproduction
https://stackblitz.com/edit/vitejs-vite-wzmngy?file=vite.config.js
Steps to reproduce
just open stackblitz, then inspect page, check the network.
System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: