fix: hmr with runtimeChunk single

This commit is contained in:
Igor Randjelovic
2021-06-04 20:29:24 +02:00
parent c265c3ac3f
commit dea18978d5
4 changed files with 15 additions and 8 deletions

View File

@ -21,7 +21,7 @@ exports[`angular configuration for android 1`] = `
ignoreWarnings: [ ignoreWarnings: [
/System.import\\\\(\\\\) is deprecated/, /System.import\\\\(\\\\) is deprecated/,
/Zone\\\\.js does not support native async\\\\/await/, /Zone\\\\.js does not support native async\\\\/await/,
/environment.(\\\\w+).ts is part of the TypeScript compilation but it's unused/ /environment(\\\\.(\\\\w+))?\\\\.ts is part of the TypeScript compilation but it's unused/
], ],
output: { output: {
path: '__jest__/platforms/android/app/src/main/assets/app', path: '__jest__/platforms/android/app/src/main/assets/app',
@ -388,7 +388,7 @@ exports[`angular configuration for ios 1`] = `
ignoreWarnings: [ ignoreWarnings: [
/System.import\\\\(\\\\) is deprecated/, /System.import\\\\(\\\\) is deprecated/,
/Zone\\\\.js does not support native async\\\\/await/, /Zone\\\\.js does not support native async\\\\/await/,
/environment.(\\\\w+).ts is part of the TypeScript compilation but it's unused/ /environment(\\\\.(\\\\w+))?\\\\.ts is part of the TypeScript compilation but it's unused/
], ],
output: { output: {
path: '__jest__/platforms/ios/jest/app', path: '__jest__/platforms/ios/jest/app',

View File

@ -1,6 +1,6 @@
{ {
"name": "@nativescript/webpack", "name": "@nativescript/webpack",
"version": "5.0.0-beta.12", "version": "5.0.0-beta.13",
"private": false, "private": false,
"main": "dist/index.js", "main": "dist/index.js",
"files": [ "files": [
@ -46,7 +46,7 @@
"ts-dedent": "2.1.1", "ts-dedent": "2.1.1",
"ts-loader": "9.2.2", "ts-loader": "9.2.2",
"vue-loader": "15.9.7", "vue-loader": "15.9.7",
"webpack": "^5.38.1", "webpack": "^5.0.0",
"webpack-bundle-analyzer": "4.4.2", "webpack-bundle-analyzer": "4.4.2",
"webpack-chain": "6.5.1", "webpack-chain": "6.5.1",
"webpack-cli": "^4.7.0", "webpack-cli": "^4.7.0",

View File

@ -151,7 +151,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
// look for platform specific polyfills first // look for platform specific polyfills first
// falling back to independent polyfills // falling back to independent polyfills
const polyfillsPath = [ const polyfillsPath = [
resolve(getEntryDirPath(), `polyfills.${getPlatformName()}.ts`), resolve(getEntryDirPath(), `polyfills.${platform}.ts`),
resolve(getEntryDirPath(), `polyfills.ts`), resolve(getEntryDirPath(), `polyfills.ts`),
].find((path) => existsSync(path)); ].find((path) => existsSync(path));
@ -191,7 +191,7 @@ export default function (config: Config, env: IWebpackEnv = _env): Config {
* | Add only entry points to the 'files' or 'include' properties in your tsconfig. | * | Add only entry points to the 'files' or 'include' properties in your tsconfig. |
* +-----------------------------------------------------------------------------------------+ * +-----------------------------------------------------------------------------------------+
*/ */
/environment.(\w+).ts is part of the TypeScript compilation but it's unused/, /environment(\.(\w+))?\.ts is part of the TypeScript compilation but it's unused/,
]) ])
); );

View File

@ -91,15 +91,22 @@ if (module.hot) {
return setStatus(hash, 'success', 'Successfully applied update.'); return setStatus(hash, 'success', 'Successfully applied update.');
}; };
const hasUpdate = () => { const requireExists = (path) => {
try { try {
__non_webpack_require__(`~/bundle.${__webpack_hash__}.hot-update.json`); __non_webpack_require__(path);
return true; return true;
} catch (err) { } catch (err) {
return false; return false;
} }
}; };
const hasUpdate = () => {
return [
`~/bundle.${__webpack_hash__}.hot-update.json`,
`~/runtime.${__webpack_hash__}.hot-update.json`,
].some((path) => requireExists(path));
};
const originalOnLiveSync = global.__onLiveSync; const originalOnLiveSync = global.__onLiveSync;
global.__onLiveSync = async function () { global.__onLiveSync = async function () {
logVerbose('LiveSync'); logVerbose('LiveSync');