static-cms/webpack.prod.js
Cássio Souza 2c8cdfc15e Webpack for production build (#134)
* Webpack config for production build
2016-10-21 21:18:45 -02:00

42 lines
1.1 KiB
JavaScript

/* global module, __dirname, require */
const path = require('path');
const webpack = require('webpack');
const merge = require('webpack-merge');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = merge.smart(require('./webpack.base.js'), {
entry: {
cms: [
'./index',
],
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js',
},
module: {
loaders: [
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract('style', 'css?modules!sass'),
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style', 'css?modules&importLoaders=1&&localIdentName=cms__[name]__[local]!postcss'),
},
],
},
context: path.join(__dirname, 'src'),
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV)
}),
new webpack.ProvidePlugin({
'fetch': 'imports?this=>global!exports?global.fetch!whatwg-fetch'
}),
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin(),
new ExtractTextPlugin('[name].css', { allChunks: true }),
],
});