webpack 配置参考(production)
2018-02-13 本文已影响8人
wlianfu
const path = require('path')
const ManifistPlugin = require('webpack-manifest-plugin')
const ExtractTextPlugin = require('extract-text-webpack-plugin')
const HtmlWebpackPlugin = require('html-webpack-plugin')
const UglifyJSPlugin = require('uglifyjs-webpack-plugin')
const modules = require('./config/base')
const config = {
entry: {
app: path.join(__dirname, '/src/container/render')
},
output: {
path: path.join(__dirname, '/build'),
filename: '[name].[hash:5].js'
},
module: modules,
resolve: {
extensions: ['.js', '.jsx', '.json', '.css', '.scss', '.sass'],
alias: {
'@': path.join(__dirname, '/src/container')
}
},
plugins: [
new ManifistPlugin(),
new ExtractTextPlugin('style.css'),
new HtmlWebpackPlugin({
template: path.join(__dirname, '/index.html')
}),
new UglifyJSPlugin({
exclude: /node_modules/
})
]
}
module.exports = config