-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.config.js
33 lines (32 loc) · 1.03 KB
/
webpack.prod.config.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
let path = require('path');
let webpack = require('webpack');
let ExtractTextPlugin = require("extract-text-webpack-plugin");
let HtmlWebpackPlugin = require('html-webpack-plugin');
let dir = 'docs';
module.exports = {
entry: ['./src/index.js'],
output: {
path: path.join(__dirname, dir),
filename: 'js/index.js'
},
module: {
loaders: [{
test: /\.js$/,
loaders: ['babel'],
include: path.join(__dirname, 'src')
}, {
test: /\.styl$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader?modules&importLoaders=1&localIdentName=[name]__[local]___[hash:base64:5]!postcss-loader!stylus-loader')
},
{
test: /\.(png|jpg)$/,
loader: 'url-loader'
}]
},
plugins: [
new webpack.DefinePlugin({ 'process.env': { 'NODE_ENV': JSON.stringify('production') } }),
new ExtractTextPlugin( 'css/styles.css', {allChunks: false }),
new webpack.optimize.UglifyJsPlugin({minimize: true}),
new HtmlWebpackPlugin({ template: 'src/template/index.html', inject: false })
]
};