2c8cdfc15e
* Webpack config for production build
42 lines
1.1 KiB
JavaScript
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 }),
|
|
],
|
|
});
|