Skip to content

Commit a54e61d

Browse files
committed
Remove deprecated calls to Tapable
1 parent 55f0f62 commit a54e61d

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/loader.js

+8-9
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,11 @@ export function pitch(request) {
3636
publicPath,
3737
};
3838
const childCompiler = this._compilation.createChildCompiler(`mini-css-extract-plugin ${NS} ${request}`, outputOptions);
39-
childCompiler.apply(new NodeTemplatePlugin(outputOptions));
40-
childCompiler.apply(new LibraryTemplatePlugin(null, 'commonjs2'));
41-
childCompiler.apply(new NodeTargetPlugin());
42-
childCompiler.apply(new SingleEntryPlugin(this.context, `!!${request}`, 'mini-css-extract-plugin'));
43-
childCompiler.apply(new LimitChunkCountPlugin({ maxChunks: 1 }));
39+
new NodeTemplatePlugin(outputOptions).apply(childCompiler);
40+
new LibraryTemplatePlugin(null, 'commonjs2').apply(childCompiler);
41+
new NodeTargetPlugin().apply(childCompiler);
42+
new SingleEntryPlugin(this.context, `!!${request}`, 'mini-css-extract-plugin').apply(childCompiler);
43+
new LimitChunkCountPlugin({ maxChunks: 1 }).apply(childCompiler);
4444
// We set loaderContext[NS] = false to indicate we already in
4545
// a child compiler so we don't spawn another child compilers from there.
4646
childCompiler.hooks.thisCompilation.tap('mini-css-extract-plugin loader', (compilation) => {
@@ -58,7 +58,7 @@ export function pitch(request) {
5858
});
5959

6060
let source;
61-
childCompiler.plugin('after-compile', (compilation, callback) => {
61+
childCompiler.hooks.afterCompile.tap('mini-css-extract-plugin', (compilation) => {
6262
source = compilation.assets[childFilename] && compilation.assets[childFilename].source();
6363

6464
// Remove all chunk assets
@@ -67,8 +67,6 @@ export function pitch(request) {
6767
delete compilation.assets[file]; // eslint-disable-line no-param-reassign
6868
});
6969
});
70-
71-
callback();
7270
});
7371

7472
const callback = this.async();
@@ -87,7 +85,8 @@ export function pitch(request) {
8785
if (!source) {
8886
return callback(new Error("Didn't get a result from child compiler"));
8987
}
90-
let text, locals;
88+
let text;
89+
let locals;
9190
try {
9291
text = exec(this, source, request);
9392
locals = text && text.locals;

0 commit comments

Comments
 (0)