Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions packages/webpack5/src/configuration/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,11 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
env.commonjs = true;
}

if (env.hmr) {
// HMR webpack should use CommonJS
env.commonjs = true;
}

// config.stats({
// logging: 'verbose'
// })
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,19 @@ if (module.hot) {
};

const hasUpdate = () => {
return [
// Prefer platform-agnostic JS hot-update manifests; fall back to JSON
// if needed. On iOS, the .hot-update.js files are present under the
// app folder (see platforms/ios <app>/bundle.*.hot-update.js), while on
// Android the JSON manifests are used by HMR. Checking JS first keeps
// behavior correct for iOS without regressing Android.
const candidates = [
`~/bundle.${__webpack_hash__}.hot-update.js`,
`~/runtime.${__webpack_hash__}.hot-update.js`,
`~/bundle.${__webpack_hash__}.hot-update.json`,
`~/runtime.${__webpack_hash__}.hot-update.json`,
].some((path) => requireExists(path));
];

return candidates.some((path) => requireExists(path));
};

if (global.__onLiveSync !== global[hmrRuntimeLastLiveSyncSymbol]) {
Expand Down
Loading