-
-
Notifications
You must be signed in to change notification settings - Fork 10
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
Plugin not working with webpack-dev-server #402
Comments
I've done some debugging and found: |
Currently my best working theory for the problem is that this plugin hooks into |
Edit: After a lot of trial and error I discovered that this is working fine for real webpack builds, just not |
@roryabraham Thanks for reporting this issue. To be honest, I wasn't expecting this plugin to be used under a development environment (with a webpack dev server) as it was originally designed for easy sharing and delivery of build files, so I didn't really tested the compatibility of this plugin with webpack dev server. (As supporting webpack dev server would usually means supporting hot reload and might makes things trickier.) I will need to wait till the weekend to be free to study the sample repository you shared and probably deep dive on how HMR works. However I managed to created a small sample on one of my old repository to test the behaviour of this plugin. I hope this can give some insight on what's the root cause behind. Sample code can be found below, please run |
@roryabraham A quick updates on my findings here. As you mentioned that the plugin works on production build, I have been focusing on finding differences in - return speedMeasure.wrap(config);
+ return config; For hot reload to work properly, I also have to add the following lines into const webpackConfig = ({envFile = '.env', platform = 'web'}) => ({
+ optimization: {
+ runtimeChunk: 'single'
+ } This makes sure you only have a single runtime (with module cache) and modules are not instantiated twice when using multiple entry points on a single page. I will try to take a look at the source code of |
Wow, thanks so much @icelam for spending time investigating this issue for us. I tried some of the workarounds listed in stephencookdev/speed-measure-webpack-plugin#167, but unfortunately couldn't get any of them to work. If you're interested in spending more time on this issue, I created an issue here with an associated bug bounty, so you can get some 🤑 for your time. Thanks. |
Environment and package version
webpack: 5.75.0
html-webpack-plugin: 5.5.0
html-inline-script-webpack-plugin: 3.1.0
Reproduction link / code sample
Coming from https://github.com/Expensify/App. Sorry it's not a minimal example but the webpack config is right here.
Steps to reproduce
npm i
npm run web
What is expected?
The specified script should be inlined in the html.
What is actually happening?
It is just showing up as a normal script tag w/
defer
The text was updated successfully, but these errors were encountered: