-
-
Notifications
You must be signed in to change notification settings - Fork 11
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
proposal: index.html substitution #1
Comments
Note: since the bug vitejs/vite#5851, |
This is also a question I have been thinking about recently. The function has actually been implemented, but I feel that there are still shortcomings. It is always necessary for the user to assign a value to the publicPath before the loader is executed. I will submit the code later. Late tomorrow morning. |
Integrating the loader sounds much more convenience but lose customization. For example if I load HTML and JS from different origins there's likely a chance that the HTML file is loaded but the JS is failed. If use a own loader the developer could attach a I'll continue to follow up your implementation after vitejs/vite#6901 landed. |
One scenario I can think of is the external dependencies in webpack, like the |
This plugin just handles JS files but the
index.html
still just loads the module files from the origin host. We need to patchindex.html
to let redirect the initial module load to the CDN host.I created another plugin to do this in my project, which transforms
<link>
and<script>
tags to JS calls of a given function (which should be declared inindex.html
file, together with placeholders to inject the JS code to).See the usage of my current implementation: plugin configuration and
index.html
(for<link>
and<script>
).I could create a PR If you consider this feature useful.
The text was updated successfully, but these errors were encountered: