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
|
||||
);
|
||||
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(
|
||||
`${external}${propertyAccess([
|
||||
used
|
||||
|
@ -172,9 +185,24 @@ class SystemLibraryPlugin extends AbstractLibraryPlugin {
|
|||
} else {
|
||||
instructions.push(
|
||||
Template.asString([
|
||||
"if (typeof module.default !== 'undefined') {",
|
||||
Template.indent([
|
||||
"Object.keys(module).forEach(function(key) {",
|
||||
Template.indent([`${external}[key] = module[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