You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the index.html I want to include a static JS File (a 3rd party JS file, not bundled with webpack):
index.html
<script src="modernizr.js"></script>
This file should be included before the main JS file (injected by html-webpack-plugin) and should not be defered. It's name should also be unique (hashed).
The text was updated successfully, but these errors were encountered:
andreivictor
changed the title
Unable to include a static JS file (generated filename does not match the filename in the index.html)
Unable to include a static JS file (generated hash does not match the hash in the index.html)
Aug 3, 2023
andreivictor
changed the title
Unable to include a static JS file (generated hash does not match the hash in the index.html)
Unable to include a static JS file (generated hashed filename does not match the hash in the index.html)
Aug 3, 2023
andreivictor
changed the title
Unable to include a static JS file (generated hashed filename does not match the hash in the index.html)
Unable to include a static JS file (generated hashed filename does not match the one in the index.html)
Aug 4, 2023
When running webpack serve, the script is included ok: <script src="modernizr.e6183722abbaa4f38f55.js"></script>
On build, the script is included in html like this: <script src="modernizr.e6183722abbaa4f38f55.js"></script>, but in the dist folder there is: modernizr.7111043e1acedc783e40.js
Current behaviour 💣
In the
index.html
I want to include a static JS File (a 3rd party JS file, not bundled withwebpack
):index.html
This file should be included before the main JS file (injected by
html-webpack-plugin)
and should not be defered. It's name should also be unique (hashed).After build, the
dist
folder contains:index.html
:but the generated js file is:
modernizr.d14201e2d4a0ec290a14.js
So the filenames do not match (content hashes are different) and the browser returns a 404 error.
When running
webpack serve
, it seems that the generated hashes are the same.Expected behaviour ☀️
After build, the generated filename should match the filename referanced in
dist
html file.Reproduction Example 👾
Use the following code above.
webpack.config.js
Environment 🖥
The text was updated successfully, but these errors were encountered: