Skip to content
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

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

Closed
4 tasks done
hex-ci opened this issue Jun 30, 2021 · 0 comments · Fixed by #4096

Comments

@hex-ci
Copy link
Contributor

hex-ci commented Jun 30, 2021

Clear and concise description of the problem

The config.base option in the __vitePreload method generated by the importAnalysisBuild.ts file in the build process should be extracted into a variable, not directly spliced into the file path. The current situation is that if you set config.base to a URL such as https://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 during build, extract config.base into a local variable to avoid repeated URL splicing.

Alternative

No response

Additional context

No response

Validations

@Shinigami92 Shinigami92 linked a pull request Jul 3, 2021 that will close this issue
9 tasks
@github-actions github-actions bot locked and limited conversation to collaborators Jul 28, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant