kana/webpack.config.prod.js

62 lines
1.7 KiB
JavaScript
Raw Normal View History

2016-07-28 17:56:13 +00:00
const webpack = require('webpack');
const fs = require('fs');
const path = require('path');
const autoprefixer = require('autoprefixer');
const precss = require('precss');
const HtmlWebPackPlugin = require('html-webpack-plugin');
2016-07-27 17:13:08 +00:00
module.exports = {
devtool: 'cheap-module-source-map',
entry: [
'./src/index'
],
output: {
path: path.resolve(__dirname, './dist'),
publicPath: './dist/',
filename: 'bundle.js'
},
resolve: {
2017-03-18 12:58:55 +00:00
extensions: ['.js', '.jsx']
2016-07-27 17:13:08 +00:00
},
plugins: [
new HtmlWebPackPlugin({
template: 'src/index.html',
filename: '../index.html'
}),
new webpack.optimize.UglifyJsPlugin({
2017-03-18 12:58:55 +00:00
sourceMap: true,
2016-07-27 17:13:08 +00:00
compress:{
warnings: false
},
}),
2017-03-18 12:58:55 +00:00
new webpack.NoEmitOnErrorsPlugin(),
new webpack.LoaderOptionsPlugin({
options: {
postcss: function() {
return [autoprefixer, precss];
}
}
})
2016-07-27 17:13:08 +00:00
],
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
2017-03-18 12:58:55 +00:00
loaders: ['babel-loader']
2016-07-27 17:13:08 +00:00
}, {
test: /\.scss$/,
loaders: ['style-loader', 'css-loader', 'postcss-loader']
}, {
test: /\.css$/,
loaders: ['style-loader', 'css-loader']
2017-03-18 12:58:55 +00:00
}, {
2016-07-27 17:13:08 +00:00
test: /\.(png|jpg|svg|woff|woff2)?(\?v=\d+.\d+.\d+)?$/,
loader: 'url-loader?limit=8192'
2017-03-18 12:58:55 +00:00
}, {
2016-07-27 17:13:08 +00:00
test: /\.(eot|ttf)$/,
loader: 'file-loader'
}
]
}
};