Skip to content

Commit

Permalink
Escape module names
Browse files Browse the repository at this point in the history
  • Loading branch information
ooflorent committed Mar 6, 2018
1 parent ae2ae4e commit f9e7a17
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/node/NodeMainTemplatePlugin.js
Expand Up @@ -29,7 +29,9 @@ module.exports = class NodeMainTemplatePlugin {
"// object to store loaded chunks",
'// "0" means "already loaded"',
"var installedChunks = {",
Template.indent(chunk.ids.map(id => `${id}: 0`).join(",\n")),
Template.indent(
chunk.ids.map(id => `${JSON.stringify(id)}: 0`).join(",\n")
),
"};"
]);
}
Expand Down
7 changes: 7 additions & 0 deletions test/configCases/async-commons-chunk/node/index.js
@@ -0,0 +1,7 @@
import "./modules/a";

it("should load", done => {
Promise.all([import("./modules/b"), import("./modules/c")]).then(() => {
done();
});
});
3 changes: 3 additions & 0 deletions test/configCases/async-commons-chunk/node/modules/a.js
@@ -0,0 +1,3 @@
import "./b";

export default "a";
1 change: 1 addition & 0 deletions test/configCases/async-commons-chunk/node/modules/b.js
@@ -0,0 +1 @@
export default "b";
3 changes: 3 additions & 0 deletions test/configCases/async-commons-chunk/node/modules/c.js
@@ -0,0 +1,3 @@
import("./a");

export default "c";
11 changes: 11 additions & 0 deletions test/configCases/async-commons-chunk/node/webpack.config.js
@@ -0,0 +1,11 @@
module.exports = {
mode: "none",
entry: {
"foo/bar": "./"
},
target: "node",
optimization: {
namedChunks: true,
namedModules: true
}
};

0 comments on commit f9e7a17

Please sign in to comment.