-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.prod.js
51 lines (50 loc) · 1.26 KB
/
webpack.config.prod.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
var path = require('path');
var webpack = require('webpack');
var HtmlWebpackPlugin = require('html-webpack-plugin')
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var packager = require('./package.json');
module.exports = {
devtool: 'source-map',
entry: {
bundle: './app/js/main'
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].js',
publicPath: './'
},
resolve: {
alias: {
images: path.join(__dirname, '/app/assets/images')
}
},
module: {
loaders: [{
test: /\.js$/,
loaders: ['babel'],
include: path.join(__dirname, 'app')
}, {
test: /\.less$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader!less-loader")
}, {
test: /\.css$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader")
}, {
test: /\.(png|jpg|jpeg|gif|svg|woff|woff2)$/,
loader: 'file?name=images/[hash].[ext]'
}]
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
}),
new HtmlWebpackPlugin({
template: 'app/htdocs/index.html',
description: packager.description
}),
new ExtractTextPlugin('[name].css')
]
};