Prebundle handle dynamic import vars
Description
When pre bundle dependencies with ESBuild. ESBuild cannot handle dynamic import properly.

A warning appears when start up

Suggested solution
Provide an option to allow pre bundle dependencies using rollup
related issue: #8781
Alternative
No response
Additional context
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that request the same feature to avoid creating a duplicate.
See https://esbuild.github.io/api/#non-analyzable-imports, esbuild only works with statically-defined imports.
Can you import a specific locale18 module, such as import('./locales/locale18.js') instead of using a concat expression.
Using Rollup to prebundle isn't quite a flip of a switch we can do. From what I can tell, Vite could provide an esbuild plugin like https://github.com/RtVision/esbuild-dynamic-import to handle dynamic import vars in esbuild.
Revisiting this, dynamic import vars in library code is non-standard, and I don't think we should support that. If you need libraries handled by Vite directly, you can add it to optimizeDeps.exclude. Or use the linked esbuild plugin.