Does not work when multiple modules are exported - the generated css is blank
sankhasp opened this issue · 0 comments
const webpack = require('webpack');
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const autoprefixer = require('autoprefixer');
const AUTOPREFIXER_BROWSERS = [
'Android 2.3',
'Android >= 4',
'Chrome >= 35',
'Firefox >= 31',
'Explorer >= 9',
'iOS >= 7',
'Opera >= 12',
'Safari >= 7.1'
];
var debug = process.env.NODE_ENV !== "production";
module.exports = {
context: dirname,
devtool: debug ? "inline-sourcemap" : null,
entry: {
"moduleA": "./src/moduleA/index.js",
"moduleB": "./src/moduleB/index.js"
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: '[name].bundle.js',
publicPath: '/'
},
resolve: {
extensions: ['', '.scss', '.css', '.js', '.json']
},
module: {
loaders: [
{
test: /(.js)|(.jsx)$/,
exclude: /(node_modules)/,
loader: 'babel',
query: {
presets: ['es2015', 'react'],
plugins: ['jsx-control-statements']
}
},
{
test: /(.scss|.css)$/,
loader: ExtractTextPlugin.extract('style', 'css?sourceMap&modules&importLoaders=1&localIdentName=[name][local]___[hash:base64:5]!postcss!sass')
}
]
},
postcss: [autoprefixer({browsers: AUTOPREFIXER_BROWSERS})],
sassLoader: {
data: '@import "theme/_config.scss";',
includePaths: [path.resolve(__dirname)]
},
externals: {
'react': 'React',
'react-dom': 'ReactDOM',
'react-addons-css-transition-group': 'React.addons.CSSTransitionGroup'
},
plugins: debug ? [new ExtractTextPlugin('main.css', { allChunks: true })] : [
new webpack.optimize.DedupePlugin(),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
mangle: false, sourcemap: false, screw_ie8: true,
warnings: false
})
]
};
webpack build output is main.css 195 bytes 0, 2, 7 [emitted] moduleA, moduleB