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

Commit

Permalink
fixed exporting module informations
Browse files Browse the repository at this point in the history
  • Loading branch information
BowlingX committed Jun 18, 2017
1 parent 8b97ee5 commit 950d7ef
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,15 +188,15 @@ ExtractTextPlugin.prototype.loader = function(options) {
ExtractTextPlugin.prototype.extract = function(options) {
if(arguments.length > 1) {
throw new Error("Breaking change: extract now only takes a single argument. Either an options " +
"object *or* the loader(s).\n" +
"Example: if your old code looked like this:\n" +
" ExtractTextPlugin.extract('style-loader', 'css-loader')\n\n" +
"You would change it to:\n" +
" ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' })\n\n" +
"The available options are:\n" +
" use: string | object | loader[]\n" +
" fallback: string | object | loader[]\n" +
" publicPath: string\n");
"object *or* the loader(s).\n" +
"Example: if your old code looked like this:\n" +
" ExtractTextPlugin.extract('style-loader', 'css-loader')\n\n" +
"You would change it to:\n" +
" ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' })\n\n" +
"The available options are:\n" +
" use: string | object | loader[]\n" +
" fallback: string | object | loader[]\n" +
" publicPath: string\n");
}
if(options.fallbackLoader) {
console.warn('fallbackLoader option has been deprecated - replace with "fallback"');
Expand Down Expand Up @@ -227,7 +227,7 @@ ExtractTextPlugin.prototype.extract = function(options) {
return [this.loader(options)]
.concat(before, loader)
.map(getLoaderObject);
}
};

ExtractTextPlugin.extract = ExtractTextPlugin.prototype.extract.bind(ExtractTextPlugin);

Expand Down Expand Up @@ -340,12 +340,14 @@ ExtractTextPlugin.prototype.apply = function(compiler) {
module.request,
module.userRequest,
module.rawRequest,
[],
module.loaders,
module.resource,
module.parser
);
newModule.id = id;
newModule._source = new OriginalSource('// removed by extract-text-webpack-plugin');
var localsMatch = module._source._value.match(/exports\.locals([\s\S]*};)/);
localsMatch = localsMatch ? 'module.exports = '+localsMatch[0] : null;
newModule._source = new OriginalSource('// removed by extract-text-webpack-plugin\n'+(localsMatch||''));
data.chunks.forEach(function (chunk) {
chunk.removeModule(module);
chunk.addModule(newModule);
Expand Down

0 comments on commit 950d7ef

Please sign in to comment.