Unverified Commit 73b859d5 authored by Joe Haddad's avatar Joe Haddad Committed by GitHub

Add `module.hot.invalidate()` to webpack HMR (#12038)

parent 68c3266a
......@@ -156,6 +156,18 @@ export default async function getBaseWebpackConfig(
const hasReactRefresh =
dev && !isServer && config.experimental.reactRefresh === true
// Inject additional features into webpack HMR runtime
if (hasReactRefresh) {
const injectPath = require.resolve(
'webpack/lib/HotModuleReplacement.runtime'
)
const overridePath = require.resolve(
'./webpack/lib/HotModuleReplacement.runtime'
)
require(overridePath)
require.cache[injectPath] = require.cache[overridePath]
}
const distDir = path.join(dir, config.distDir)
const defaultLoaders = {
babel: {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment