diff --git a/lib/SystemMainTemplatePlugin.js b/lib/SystemMainTemplatePlugin.js index 483cd509e33..0958fd89847 100644 --- a/lib/SystemMainTemplatePlugin.js +++ b/lib/SystemMainTemplatePlugin.js @@ -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( @@ -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") ), "]," ]); @@ -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([");"]), "}"]), + "};" + ]), + "})" + ]) ); };