fix: fixed work of the non-system type externals for "system" library target
This commit is contained in:
parent
444e59f8a4
commit
1f11600acd
|
@ -31,7 +31,9 @@ class SystemMainTemplatePlugin {
|
|||
const { mainTemplate, chunkTemplate } = compilation;
|
||||
|
||||
const onRenderWithEntry = (source, chunk, hash) => {
|
||||
const externals = chunk.getModules().filter(m => m.external);
|
||||
const externals = chunk
|
||||
.getModules()
|
||||
.filter(m => m.external && m.externalType === "system");
|
||||
|
||||
// The name this bundle should be registered as with System
|
||||
const name = this.name
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
/* This test verifies that webpack externals that have different to System type are properly
|
||||
* accessible within System.js bundle.
|
||||
*/
|
||||
it("should correctly handle externals of different type", function() {
|
||||
expect(require("rootExt")).toEqual("works");
|
||||
expect(require("varExt")).toEqual("works");
|
||||
expect(require("windowExt")).toEqual("works");
|
||||
});
|
|
@ -0,0 +1,16 @@
|
|||
const System = require("../../../helpers/fakeSystem");
|
||||
|
||||
module.exports = {
|
||||
beforeExecute: () => {
|
||||
System.init();
|
||||
},
|
||||
moduleScope(scope) {
|
||||
scope.window.windowExt = "works";
|
||||
scope.rootExt = "works";
|
||||
scope.varExt = "works";
|
||||
scope.System = System;
|
||||
},
|
||||
afterExecute: () => {
|
||||
System.execute("(anonym)");
|
||||
}
|
||||
};
|
|
@ -0,0 +1,11 @@
|
|||
module.exports = {
|
||||
output: {
|
||||
libraryTarget: "system"
|
||||
},
|
||||
target: "web",
|
||||
externals: {
|
||||
rootExt: "root rootExt",
|
||||
varExt: "var varExt",
|
||||
windowExt: "window windowExt"
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue