Skip to content

Instantly share code, notes, and snippets.

@timse
Created May 16, 2017 13:38
Show Gist options
  • Save timse/255e1dcc8e0fb4410cbf269a9aa3c934 to your computer and use it in GitHub Desktop.
Save timse/255e1dcc8e0fb4410cbf269a9aa3c934 to your computer and use it in GitHub Desktop.
// webpack.config.js
// ...
plugins: [
// ...
new webpack.NamedChunksPlugin((chunk) => {
if (chunk.name) {
return chunk.name;
}
return chunk.modules.map(m => path.relative(m.context, m.request)).join("_");
}),
]
@michael-ciniawsky
Copy link

- return chunk.modules.map(m => path.relative(m.context, m.request)).join("_"); 
+ return chunk.mapModules(m => path.relative(m.context, m.request)).join("_"); <= webpack >= v3.0.0

😛

@fidelman
Copy link

return Array.from(chunk.modulesIterable, m => path.relative(m.context || '', m.request)).join('_')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment