Skip to content

Commit

Permalink
formating of output code
Browse files Browse the repository at this point in the history
  • Loading branch information
sokra committed Apr 10, 2019
1 parent a061d0f commit 39a680d
Showing 1 changed file with 19 additions and 16 deletions.
35 changes: 19 additions & 16 deletions lib/SystemMainTemplatePlugin.js
Expand Up @@ -34,7 +34,7 @@ class SystemMainTemplatePlugin {
const externals = chunk.getModules().filter(m => m.external);

// The name this bundle should be registered as with System
const name = this.name ? `"${this.name}", ` : "";
const name = this.name ? `${JSON.stringify(this.name)}, ` : "";

// The array of dependencies that are external to webpack and will be provided by System
const systemDependencies = JSON.stringify(
Expand Down Expand Up @@ -64,13 +64,15 @@ class SystemMainTemplatePlugin {
: Template.asString([
"setters: [",
Template.indent(
externalWebpackNames.map((external, index) =>
Template.asString([
"function(module) {",
Template.indent(`${external} = module;`),
`}${index < externalWebpackNames.length - 1 ? "," : ""}`
])
)
externalWebpackNames
.map(external =>
Template.asString([
"function(module) {",
Template.indent(`${external} = module;`),
"}"
])
)
.join(",\n")
),
"],"
]);
Expand All @@ -87,15 +89,16 @@ class SystemMainTemplatePlugin {
Template.indent(`${dynamicExport}(`)
])
])
]),
]) + "\n",
source,
Template.asString([
Template.indent([
Template.indent([Template.indent([");"]), "}"]),
"};"
]),
"})"
])
"\n" +
Template.asString([
Template.indent([
Template.indent([Template.indent([");"]), "}"]),
"};"
]),
"})"
])
);
};

Expand Down

0 comments on commit 39a680d

Please sign in to comment.