Skip to content

Commit 781af6c

Browse files
committed
fix: remove DeprecationWarning from webpack4
1 parent 90e0910 commit 781af6c

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

src/index.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -187,17 +187,20 @@ export default class CSSSplitWebpackPlugin {
187187
// Run on `emit` when user specifies the compiler phase
188188
// Due to the incorrect css split + optimization behavior
189189
// Expected: css split should happen after optimization
190-
compiler.plugin('emit', (compilation, done) => {
190+
compiler.hooks.emit.tapAsync('css-split-emit', (compilation, done) => {
191191
return this.chunksMapping(compilation, compilation.chunks, done);
192192
});
193193
} else {
194194
// Only run on `this-compilation` to avoid injecting the plugin into
195195
// sub-compilers as happens when using the `extract-text-webpack-plugin`.
196-
compiler.plugin('this-compilation', (compilation) => {
197-
compilation.plugin('optimize-chunk-assets', (chunks, done) => {
198-
return this.chunksMapping(compilation, chunks, done);
196+
compiler.hooks.thisCompilation.tap('css-split-this-compilation',
197+
(compilation) => {
198+
compilation.hooks.optimizeChunkAssets.tapAsync(
199+
'css-split-optimize-chunk-assets',
200+
(chunks, done) => {
201+
return this.chunksMapping(compilation, chunks, done);
202+
});
199203
});
200-
});
201204
}
202205
}
203206
}

0 commit comments

Comments
 (0)