-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.js
74 lines (73 loc) · 1.68 KB
/
webpack.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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
var path = require('path');
var webpack = require('webpack');
var buildPath = path.resolve(__dirname, 'public');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
module.exports = {
entry: ['./src/index'],
output: {
path: buildPath, //Path where the bundle should be exported
filename: 'js/bundle.[hash].js', //Filename
publicPath: '/' //Where the js gets loaded from
},
eslint: {
configFile: '.eslintrc',
failOnWarning: true,
failOnError: true
},
module: {
preLoaders: [{
test: /\.json$/,
exclude: /(node_modules)/,
loader: 'json'
}],
loaders: [
{
test: /\.jsx?$/,
loaders: ['babel-loader'],
include: path.join(__dirname, 'src'),
exclude: /(node_modules|bower_components)/
}, {
test: /\.less$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader", "less-loader"),
include: path.join(__dirname, 'src', 'Less')
},
{
test: /\.(png|jpg|jpeg|svg|woff|woff2|eot|ttf|otf)$/,
loader: 'url-loader'
},
{
test: /\.html$/,
loader: 'html-loader'
},
]
},
resolve: {
root: path.resolve('./src'),
extenstions: ['', '.js']
},
plugins: [
new webpack.optimize.OccurenceOrderPlugin(),
new webpack.optimize.UglifyJsPlugin({
output: {
comments: false,
},
compressor: {
warnings: false,
screw_ie8: true
}
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify('production')
}),
new ExtractTextPlugin('css/style.[hash].css'),
new HtmlWebpackPlugin({
filename: 'index.html',
template: 'src/Template/template.html',
inject: 'body',
hash: true,
cache: true,
showErrors: false
})
]
}