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

refactor: don't throw errors in case of child context #390

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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 1 addition & 6 deletions loader.js
Expand Up @@ -23,12 +23,7 @@ module.exports.pitch = function(request) {
var loaders = this.loaders.slice(this.loaderIndex + 1);
this.addDependency(this.resourcePath);
// We already in child compiler, return empty bundle
if(this[NS] === undefined) {
throw new Error(
'"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) {
if(this[NS] === undefined || this[NS] === false) {
return "";
Copy link
Member

Choose a reason for hiding this comment

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

this.emitWarning(`
  The extract-text-webpack-plugin loader is used without the corresponding plugin,
  in case this is unintentional refer to https://github.com/webpack/extract-text-webpack-plugin 
  for correct usage (example)
`)

Or similiar 😛

Copy link
Member

@joshwiens joshwiens May 2, 2017

Choose a reason for hiding this comment

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

Should probably emit here no? ( Ha, finally got to not be on the receiving end of console.warn hand slap! )

In any case, this needs to do something. The black hole approach is less than optimal for consumers, particularly those lacking a deep understanding of what extract text is doing contextually.

Copy link
Member

Choose a reason for hiding this comment

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

good catch, yep this.emitWarning 😛, example updated ☝️

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