Skip to content

Commit 950d7ef

Browse files
committed
fixed exporting module informations
1 parent 8b97ee5 commit 950d7ef

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

index.js

+14-12
Original file line numberDiff line numberDiff line change
@@ -188,15 +188,15 @@ ExtractTextPlugin.prototype.loader = function(options) {
188188
ExtractTextPlugin.prototype.extract = function(options) {
189189
if(arguments.length > 1) {
190190
throw new Error("Breaking change: extract now only takes a single argument. Either an options " +
191-
"object *or* the loader(s).\n" +
192-
"Example: if your old code looked like this:\n" +
193-
" ExtractTextPlugin.extract('style-loader', 'css-loader')\n\n" +
194-
"You would change it to:\n" +
195-
" ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' })\n\n" +
196-
"The available options are:\n" +
197-
" use: string | object | loader[]\n" +
198-
" fallback: string | object | loader[]\n" +
199-
" publicPath: string\n");
191+
"object *or* the loader(s).\n" +
192+
"Example: if your old code looked like this:\n" +
193+
" ExtractTextPlugin.extract('style-loader', 'css-loader')\n\n" +
194+
"You would change it to:\n" +
195+
" ExtractTextPlugin.extract({ fallback: 'style-loader', use: 'css-loader' })\n\n" +
196+
"The available options are:\n" +
197+
" use: string | object | loader[]\n" +
198+
" fallback: string | object | loader[]\n" +
199+
" publicPath: string\n");
200200
}
201201
if(options.fallbackLoader) {
202202
console.warn('fallbackLoader option has been deprecated - replace with "fallback"');
@@ -227,7 +227,7 @@ ExtractTextPlugin.prototype.extract = function(options) {
227227
return [this.loader(options)]
228228
.concat(before, loader)
229229
.map(getLoaderObject);
230-
}
230+
};
231231

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

@@ -340,12 +340,14 @@ ExtractTextPlugin.prototype.apply = function(compiler) {
340340
module.request,
341341
module.userRequest,
342342
module.rawRequest,
343-
[],
343+
module.loaders,
344344
module.resource,
345345
module.parser
346346
);
347347
newModule.id = id;
348-
newModule._source = new OriginalSource('// removed by extract-text-webpack-plugin');
348+
var localsMatch = module._source._value.match(/exports\.locals([\s\S]*};)/);
349+
localsMatch = localsMatch ? 'module.exports = '+localsMatch[0] : null;
350+
newModule._source = new OriginalSource('// removed by extract-text-webpack-plugin\n'+(localsMatch||''));
349351
data.chunks.forEach(function (chunk) {
350352
chunk.removeModule(module);
351353
chunk.addModule(newModule);

0 commit comments

Comments
 (0)