2015-06-15 15:21:19 +02:00
|
|
|
|
|
|
|
var webpack = require('webpack');
|
|
|
|
var path = require('path');
|
|
|
|
var loaders = require('./webpack.loaders');
|
|
|
|
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
|
|
|
var HtmlWebpackPlugin = require('html-webpack-plugin');
|
|
|
|
var WebpackCleanupPlugin = require('webpack-cleanup-plugin');
|
|
|
|
|
|
|
|
// local css modules
|
|
|
|
loaders.push({
|
|
|
|
test: /[\/\\]src[\/\\].*\.css/,
|
|
|
|
loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]')
|
|
|
|
});
|
|
|
|
|
|
|
|
// local scss modules
|
|
|
|
loaders.push({
|
|
|
|
test: /[\/\\]src[\/\\].*\.scss/,
|
|
|
|
loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]', 'sass')
|
|
|
|
});
|
|
|
|
// global css files
|
|
|
|
loaders.push({
|
|
|
|
test: /[\/\\](node_modules|global)[\/\\].*\.css$/,
|
|
|
|
loader: ExtractTextPlugin.extract('style', 'css')
|
|
|
|
});
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
entry: [
|
|
|
|
'./src/index.jsx'
|
|
|
|
],
|
|
|
|
output: {
|
|
|
|
path: path.join(__dirname, 'public'),
|
|
|
|
filename: '[chunkhash].js'
|
|
|
|
},
|
|
|
|
resolve: {
|
|
|
|
extensions: ['', '.js', '.jsx']
|
|
|
|
},
|
|
|
|
module: {
|
|
|
|
loaders
|
|
|
|
},
|
|
|
|
plugins: [
|
|
|
|
new WebpackCleanupPlugin(),
|
|
|
|
new webpack.DefinePlugin({
|
|
|
|
'process.env': {
|
|
|
|
NODE_ENV: '"production"'
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
new webpack.optimize.UglifyJsPlugin({
|
|
|
|
compress: {
|
|
|
|
warnings: false,
|
|
|
|
screw_ie8: true,
|
|
|
|
drop_console: true,
|
|
|
|
drop_debugger: true
|
|
|
|
}
|
|
|
|
}),
|
|
|
|
new webpack.optimize.OccurenceOrderPlugin(),
|
|
|
|
new ExtractTextPlugin('[contenthash].css', {
|
|
|
|
allChunks: true
|
|
|
|
}),
|
|
|
|
new HtmlWebpackPlugin({
|
|
|
|
template: './src/template.html',
|
2016-09-09 23:25:06 +02:00
|
|
|
title: 'Mapolo'
|
2015-06-15 15:21:19 +02:00
|
|
|
}),
|
|
|
|
new webpack.optimize.DedupePlugin()
|
|
|
|
]
|
|
|
|
};
|