site/frontend/webpack.production.config.js

70 lines
1.6 KiB
JavaScript
Raw Normal View History

2016-12-14 07:11:20 +00:00
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin');
2016-12-18 05:14:25 +00:00
var webpackUglifyJsPlugin = require('webpack-uglify-js-plugin');
var FaviconsWebpackPlugin = require('favicons-webpack-plugin');
2016-12-14 07:11:20 +00:00
module.exports = {
entry: [ path.join(__dirname, 'support/index.js') ],
output: {
path: path.resolve('./static/dist'),
filename: '[name]-[hash].min.js',
publicPath: '/dist/'
},
module: {
loaders: [
{
test: /\.purs$/,
loader: 'purs-loader',
exclude: /node_modules/,
query: {
psc: 'psa',
bundle: true,
warnings: false
}
}
],
},
plugins: [
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new webpack.optimize.OccurrenceOrderPlugin(true),
new webpack.LoaderOptionsPlugin({
minimize: true,
debug: false
}),
new HtmlWebpackPlugin({
template: 'support/index.html',
inject: 'body',
filename: 'index.html'
}),
2016-12-18 05:14:25 +00:00
new FaviconsWebpackPlugin('../static/img/avatar.png'),
new webpack.optimize.DedupePlugin(),
2016-12-18 16:51:15 +00:00
new webpack.optimize.UglifyJsPlugin({
beautify: false,
mangle: true,
comments: false,
compress: {
dead_code: true,
loops: true,
if_return: true,
unused: true,
2016-12-18 05:14:25 +00:00
warnings: false
}
2016-12-18 16:51:15 +00:00
})
2016-12-14 07:11:20 +00:00
],
resolveLoader: {
modules: [
path.join(__dirname, 'node_modules')
]
},
resolve: {
modules: [
'node_modules',
'bower_components'
],
extensions: ['.js', '.purs']
}
};