react-tiny-components-prese.../webpack.config.js

52 lines
1.5 KiB
JavaScript
Raw Permalink Normal View History

2015-09-30 02:04:16 +00:00
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var CompressionPlugin = require('compression-webpack-plugin');
var WatchIgnorePlugin = require('watch-ignore-webpack-plugin');
var path = require('path');
var COMPRESS = false;
module.exports = {
context: __dirname + '/src',
entry: ['./index.js', './global.scss'],
output: {
path: __dirname + '/dist',
filename: 'presentation.js'
},
devtool: 'inline-source-map',
watchOptions: {
2015-10-05 12:43:19 +00:00
poll: true,
2015-09-30 02:04:16 +00:00
aggregateTimeout: 1000
},
module: {
loaders: [
{ test: /\.js$/, include: /\/src\//, loader: "babel-loader?stage=0"},
{
test: /styles\.scss$/, include: /\/src\//,
loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!sass')
},
{
test: /global.scss$/, include: /\/src\//,
loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=1&localIdentName=[local]!sass')
},
{ test: /\.html$/, include: /\/src\//, loader: 'file?name=[name].[ext]' },
{ test: /\.{jpg,png}/, include: /\/src\//, loader: 'image-size?name=[name].[ext]' }
]
},
plugins: [
new ExtractTextPlugin('style.css', { allChunks: true }),
new WatchIgnorePlugin([
path.resolve(__dirname ,'./node_modules/')
])
]
};
if (COMPRESS) {
module.exports.plugins.push(
new CompressionPlugin({
asset: '{file}.gz',
algorithm: 'gzip',
regExp: /\.(js|html|css)$/
})
);
}