We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2e87cab commit 376badbCopy full SHA for 376badb
lib/NamedChunksPlugin.js
@@ -0,0 +1,30 @@
1
+/*
2
+ MIT License http://www.opensource.org/licenses/mit-license.php
3
+ Author Tobias Koppers @sokra
4
+*/
5
+"use strict";
6
+
7
+class NamedChunksPlugin {
8
9
+ static defaultNameResolver(chunk) {
10
+ return chunk.name || null;
11
+ }
12
13
+ constructor(nameResolver) {
14
+ this.nameResolver = nameResolver || NamedChunksPlugin.defaultNameResolver;
15
16
17
+ apply(compiler) {
18
+ compiler.plugin("compilation", (compilation) => {
19
+ compilation.plugin("before-chunk-ids", (chunks) => {
20
+ chunks.forEach((chunk) => {
21
+ if(chunk.id === null) {
22
+ chunk.id = this.nameResolver(chunk);
23
24
+ });
25
26
27
28
+}
29
30
+module.exports = NamedChunksPlugin;
0 commit comments