-
-
Notifications
You must be signed in to change notification settings - Fork 7.5k
Description
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 use SystemJS.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
System:
OS: macOS 13.6.6
CPU: (8) arm64 Apple M1 Pro
Memory: 62.73 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.20.2 - ~/.nvm/versions/node/v18.20.2/bin/node
npm: 10.5.0 - ~/.nvm/versions/node/v18.20.2/bin/npm
pnpm: 8.10.3 - ~/.nvm/versions/node/v18.20.2/bin/pnpm
Browsers:
Chrome: 124.0.6367.62
Safari: 16.6
npmPackages:
@vitejs/plugin-react: ^4.2.1 => 4.2.1
vite: ^5.2.0 => 5.2.9Used Package Manager
npm
Logs
No response
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.