mirror of https://github.com/webpack/webpack.git
Merge bd51be4493
into 9f98d803c0
This commit is contained in:
commit
a40834d64c
|
@ -133,7 +133,20 @@ class SystemLibraryPlugin extends AbstractLibraryPlugin {
|
||||||
chunk.runtime
|
chunk.runtime
|
||||||
);
|
);
|
||||||
if (used) {
|
if (used) {
|
||||||
if (otherUnused || used !== exportInfo.name) {
|
if (used === "default" && exportInfo.name === "default") {
|
||||||
|
instructions.push(
|
||||||
|
Template.asString([
|
||||||
|
"if (typeof module.default !== 'undefined') {",
|
||||||
|
Template.indent([
|
||||||
|
`${external}.default = module.default;`
|
||||||
|
]),
|
||||||
|
"} else {",
|
||||||
|
Template.indent([`${external} = module;`]),
|
||||||
|
"}"
|
||||||
|
])
|
||||||
|
);
|
||||||
|
handledNames.push(exportInfo.name);
|
||||||
|
} else if (otherUnused || used !== exportInfo.name) {
|
||||||
instructions.push(
|
instructions.push(
|
||||||
`${external}${propertyAccess([
|
`${external}${propertyAccess([
|
||||||
used
|
used
|
||||||
|
@ -172,9 +185,24 @@ class SystemLibraryPlugin extends AbstractLibraryPlugin {
|
||||||
} else {
|
} else {
|
||||||
instructions.push(
|
instructions.push(
|
||||||
Template.asString([
|
Template.asString([
|
||||||
"Object.keys(module).forEach(function(key) {",
|
"if (typeof module.default !== 'undefined') {",
|
||||||
Template.indent([`${external}[key] = module[key];`]),
|
Template.indent([
|
||||||
"});"
|
"Object.keys(module).forEach(function(key) {",
|
||||||
|
Template.indent([
|
||||||
|
`${external}[key] = module[key];`
|
||||||
|
]),
|
||||||
|
"});"
|
||||||
|
]),
|
||||||
|
"} else {",
|
||||||
|
Template.indent([
|
||||||
|
`${external} = module;`,
|
||||||
|
"Object.keys(module).forEach(function(key) {",
|
||||||
|
Template.indent([
|
||||||
|
`${external}[key] = module[key];`
|
||||||
|
]),
|
||||||
|
"});"
|
||||||
|
]),
|
||||||
|
"}"
|
||||||
])
|
])
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue