The config.base
option in the __vitePreload
method generated during the build
process should be extracted into a variable, not directly spliced into the file path.
#4038
Labels
Clear and concise description of the problem
The
config.base
option in the__vitePreload
method generated by theimportAnalysisBuild.ts
file in thebuild
process should be extracted into a variable, not directly spliced into the file path. The current situation is that if you setconfig.base
to a URL such ashttps://example.com/xxx/yyy
, it will cause a large number of duplicate URLs in the generated code. Although gzip can solve some problems, If the URL is extracted into a variable(Webpack uses a similar approach), the amount of generated code will be greatly reduced.Suggested solution
Improve the function of the
vite:import-analysis
plugin duringbuild
, extractconfig.base
into a local variable to avoid repeated URL splicing.Alternative
No response
Additional context
No response
Validations
The text was updated successfully, but these errors were encountered: