Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Commit ae9cb8e

Browse files
author
Dimitar Tachev
authored
Merge pull request #924 from NativeScript/tachev/fix-custom-output
fix: do not include hot updates when generating requires in entry files
2 parents 48b26f4 + 27360fd commit ae9cb8e

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

Diff for: plugins/GenerateNativeScriptEntryPointsPlugin.js

+11-3
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ exports.GenerateNativeScriptEntryPointsPlugin = (function () {
5656
entryChunk = chunk;
5757
} else {
5858
chunk.files.forEach(fileName => {
59-
requireChunkFiles += `require("./${fileName}");`;
59+
if (!this.isHMRFile(fileName)) {
60+
requireChunkFiles += `require("./${fileName}");`;
61+
}
6062
});
6163
}
6264

@@ -72,8 +74,10 @@ exports.GenerateNativeScriptEntryPointsPlugin = (function () {
7274
throw new Error(`${GenerationFailedError} File "${fileName}" not found for entry "${entryPointName}".`);
7375
}
7476

75-
const currentEntryFileContent = compilation.assets[fileName].source();
76-
compilation.assets[fileName] = new RawSource(`${requireDeps}${currentEntryFileContent}`);
77+
if (!this.isHMRFile(fileName)) {
78+
const currentEntryFileContent = compilation.assets[fileName].source();
79+
compilation.assets[fileName] = new RawSource(`${requireDeps}${currentEntryFileContent}`);
80+
}
7781
});
7882
}
7983

@@ -84,5 +88,9 @@ exports.GenerateNativeScriptEntryPointsPlugin = (function () {
8488
}
8589
}
8690

91+
GenerateNativeScriptEntryPointsPlugin.prototype.isHMRFile = function (fileName) {
92+
return fileName.indexOf("hot-update") > -1;
93+
}
94+
8795
return GenerateNativeScriptEntryPointsPlugin;
8896
})();

0 commit comments

Comments
 (0)