Skip to content

Remove deprecated calls to Tapable #16

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ export function pitch(request) {
publicPath,
};
const childCompiler = this._compilation.createChildCompiler(`mini-css-extract-plugin ${NS} ${request}`, outputOptions);
childCompiler.apply(new NodeTemplatePlugin(outputOptions));
childCompiler.apply(new LibraryTemplatePlugin(null, 'commonjs2'));
childCompiler.apply(new NodeTargetPlugin());
childCompiler.apply(new SingleEntryPlugin(this.context, `!!${request}`, 'mini-css-extract-plugin'));
childCompiler.apply(new LimitChunkCountPlugin({ maxChunks: 1 }));
new NodeTemplatePlugin(outputOptions).apply(childCompiler);
new LibraryTemplatePlugin(null, 'commonjs2').apply(childCompiler);
new NodeTargetPlugin().apply(childCompiler);
new SingleEntryPlugin(this.context, `!!${request}`, 'mini-css-extract-plugin').apply(childCompiler);
new LimitChunkCountPlugin({ maxChunks: 1 }).apply(childCompiler);
// We set loaderContext[NS] = false to indicate we already in
// a child compiler so we don't spawn another child compilers from there.
childCompiler.hooks.thisCompilation.tap('mini-css-extract-plugin loader', (compilation) => {
Expand All @@ -58,7 +58,7 @@ export function pitch(request) {
});

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

// Remove all chunk assets
Expand All @@ -67,8 +67,6 @@ export function pitch(request) {
delete compilation.assets[file]; // eslint-disable-line no-param-reassign
});
});

callback();
});

const callback = this.async();
Expand All @@ -87,7 +85,8 @@ export function pitch(request) {
if (!source) {
return callback(new Error("Didn't get a result from child compiler"));
}
let text, locals;
let text;
let locals;
try {
text = exec(this, source, request);
locals = text && text.locals;
Expand Down