Skip to content
This repository has been archived by the owner on May 29, 2019. It is now read-only.

refactor(loader): do not throw errors in case of child context #688

Closed
wants to merge 1 commit into from
Closed
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
5 changes: 2 additions & 3 deletions src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ export function pitch(request) {
let loaders = this.loaders.slice(this.loaderIndex + 1);
this.addDependency(this.resourcePath);
// We already in child compiler, return empty bundle
if (this[NS] === undefined) { // eslint-disable-line no-undefined
throw new Error(
if (this[NS] === undefined || this[NS] === false) { // eslint-disable-line no-undefined
this.emitWarning(
'"extract-text-webpack-plugin" loader is used without the corresponding plugin, ' +
'refer to https://github.com/webpack/extract-text-webpack-plugin for the usage example',
);
} else if (this[NS] === false) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why emit warning on false?

return '';
} else if (this[NS](null, query)) {
if (query.omit) {
Expand Down