Unexpected: "ERROR in <blah> doesn't export content" #42
Description
When running ./node_modules/webpack/bin/webpack.js --watch
, an error shows up in the terminal after changing a CSS file ("ERROR in doesn't export content"), and the webpack compilation seems to run twice.
The high-level setup is as follows: two entry points, one (OneEntry.js
) does a synchronous require of Dep.js
, and the other (TwoEntry.js
) does a require.ensure of Dep.js
. Dep.js
requires Dep.css
. Changing Dep.css
while running with --watch
triggers the error message.
The final output doesn't seem to be affected (at least in my simple example here), but it's still a scary message. I started to step through it with node-debug, but didn't get much farther than figuring out where the error was coming from -- line 156 of extract-text-webpack-plugin/index.js
. I'll probably look at it at little further tomorrow.
My webpack.config.js:
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
target: "web",
debug: true,
// devtool: "source-map",
entry: {
One: './OneEntry.js',
Two: './TwoEntry.js'
},
output: {
path: "./target",
filename: "[name].bundle.js"
},
module: {
loaders: [
{ test: /\.css$/, loader: ExtractTextPlugin.extract("style-loader", "css-loader") },
]
},
plugins: [
new ExtractTextPlugin("[name].styles.css")
]
};
OneEntry.js
require('./Dep.js');
module.exports = function () {
console.log("OneEntry");
}
TwoEntry.js
module.exports = function () {
require.ensure([], function (require) {
var One = require('./Dep.js');
});
}
Dep.js
require('./Dep.css');
module.exports = function helloWorld() {
console.log("Hello, World!");
}
Dep.css
body {
font-weight: normal;
}
Console output:
[10:30:58] extract-text-plugin-bug-repro$ ./node_modules/webpack/bin/webpack.js --watch
Hash: 1af67a17d8cdba702d4f
Version: webpack 1.4.13
Time: 123ms
Asset Size Chunks Chunk Names
Two.bundle.js 3850 0 [emitted] Two
1.1.bundle.js 332 1 [emitted]
One.bundle.js 1886 2, 1 [emitted] One
One.styles.css 32 2, 1 [emitted] One
[0] ./OneEntry.js 81 {2} [built]
[0] ./TwoEntry.js 113 {0} [built]
[1] ./Dep.js 103 {1} {2} [built]
+ 4 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
Hash: 33291634f4065e501d4e
Version: webpack 1.4.13
Time: 24ms
Asset Size Chunks Chunk Names
1.1.bundle.js 332 1 [emitted]
One.bundle.js 1886 2, 1 [emitted] One
One.styles.css 30 2, 1 [emitted] One
+ 7 hidden modules
Child extract-text-webpack-plugin:
+ 2 hidden modules
Hash: 2ed4f9458139cfb59089
Version: webpack 1.4.13
Time: 8ms
Asset Size Chunks Chunk Names
1.1.bundle.js 1253 1 [emitted]
One.bundle.js 2807 2, 1 [emitted] One
One.styles.css 30 2, 1 [emitted] One
+ 7 hidden modules
ERROR in /path/extract-text-plugin-bug-repro/node_modules/extract-text-webpack-plugin/loader.js?{"omit":1,"extract":true,"remove":true}!/path/extract-text-plugin-bug-repro/node_modules/style-loader/index.js!/path/extract-text-plugin-bug-repro/node_modules/css-loader/index.js!/path/extract-text-plugin-bug-repro/Dep.css doesn't export content