This repository has been archived by the owner on Sep 18, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 31
/
webpack.config.build.js
76 lines (73 loc) · 1.61 KB
/
webpack.config.build.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
75
76
var webpack = require('webpack')
var HtmlWebpackPlugin = require('html-webpack-plugin')
var settings = require('../../enclave.js')
var pathPrefix = '../../'
var HTMLWebpackPluginConfig = new HtmlWebpackPlugin({
template: pathPrefix + settings.index,
filename: 'index.html',
inject: 'body'
})
var UglifyJsPluginConfig = new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
module.exports = {
entry: [
pathPrefix + settings.entry
],
output: {
path: pathPrefix + settings.output,
filename: 'index_bundle.js'
},
module: {
loaders: [
{
test: /\.js[x]?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: [
'es2015',
'stage-0',
'react'
]
}
},
{
test: /\.json$/,
exclude: /node_modules/,
loader: 'json'
},
{
test: /\.(otf|eot|ttf|woff|png|jpe?g|txt)/i,
loader: 'url-loader?limit=8192'
},
{
test: /\.svg$/,
exclude: /node_modules/,
loader: 'raw-loader'
},
{
test: /\.[s]?css$/,
exclude: /node_modules/,
loader: 'style-loader!css-loader!sass-loader'
}
]
},
plugins: [
HTMLWebpackPluginConfig,
UglifyJsPluginConfig,
new webpack.optimize.DedupePlugin(),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) || '"production"',
}),
],
devServer: {
contentBase: pathPrefix + settings.output,
hot: true,
},
resolve: {
extensions: ['', '.js', '.jsx']
}
}