Bug report
What is the current behavior?
When using webpack-dev-server with hot: true and a separate styles entry point, the compiled styles.js throws at runtime:
Error: [HMR] Hot Module Replacement is disabled.
This started happening after [email protected] was published (2026-03-23).
What is the expected behavior?
module.hot should evaluate as truthy in the styles entry when HMR is enabled, so webpack/hot/dev-server.js doesn't throw.
Minimal reproduction
https://github.com/FrozenPandaz/webpack-hmr-styles-repro
git clone https://github.com/FrozenPandaz/webpack-hmr-styles-repro
cd webpack-hmr-styles-repro
pnpm install
pnpm serve
# Open http://localhost:4200 — browser console shows the error
Pinning tapable to 2.3.0 resolves the issue.
Root cause
HotModuleReplacementPlugin taps parser.hooks.evaluateIdentifier.for("module.hot") with before: "NodeStuffPlugin". This ensures module.hot evaluates as truthy so webpack keeps the if (module.hot) branch.
However, NodeStuffPlugin never taps evaluateIdentifier for module.hot, so the before reference is invalid.
- tapable 2.3.0: invalid
before → tap inserted at position 0 → module.hot evaluates truthy → works
- tapable 2.3.1: tapable PR #198 deletes invalid
before names → tap goes to natural position → module.hot evaluates falsy for styles entry → throws
Other relevant information:
- webpack: 5.105.4
- webpack-cli: 7.0.2
- webpack-dev-server: 5.2.3
- tapable: 2.3.1 (works with 2.3.0)
- Node.js: v24.9.0
- OS: Linux
Bug report
What is the current behavior?
When using
webpack-dev-serverwithhot: trueand a separatestylesentry point, the compiledstyles.jsthrows at runtime:This started happening after
[email protected]was published (2026-03-23).What is the expected behavior?
module.hotshould evaluate as truthy in the styles entry when HMR is enabled, sowebpack/hot/dev-server.jsdoesn't throw.Minimal reproduction
https://github.com/FrozenPandaz/webpack-hmr-styles-repro
Pinning
tapableto2.3.0resolves the issue.Root cause
HotModuleReplacementPlugintapsparser.hooks.evaluateIdentifier.for("module.hot")withbefore: "NodeStuffPlugin". This ensuresmodule.hotevaluates as truthy so webpack keeps theif (module.hot)branch.However,
NodeStuffPluginnever tapsevaluateIdentifierformodule.hot, so thebeforereference is invalid.before→ tap inserted at position 0 →module.hotevaluates truthy → worksbeforenames → tap goes to natural position →module.hotevaluates falsy for styles entry → throwsOther relevant information: