-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.production.config.js
87 lines (85 loc) · 2.3 KB
/
webpack.production.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
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
77
78
79
80
81
82
83
84
85
86
87
var resolve = require('path').resolve
var HtmlWebpackPlugin = require('html-webpack-plugin')
var validate = require('webpack-validator')
var webpack = require('webpack')
var config = {
entry: {
script: resolve(__dirname, 'src', 'scripts', 'index.tsx'),
prototype: resolve(__dirname, 'prototypes', 'prototype.ts')
},
output: {
path: resolve(__dirname, 'www'),
filename: '[name].js',
publicPath: '/'
},
module: {
loaders: [
{test: /\.css$/, loaders: ['style',
'css?modules&importLoaders=1&localIdentName=[local]',
'postcss']},
{ test: /\.tsx?$/, loader: 'ts'}
],
preLoaders: [
{ test: /\.jsx?$/, loader: 'source-map' }
]
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
}),
new webpack.optimize.UglifyJsPlugin(),
new HtmlWebpackPlugin({
template: resolve(__dirname, 'src', 'index.html'),
filename: 'index.html',
chunks: ['script']
}),
new HtmlWebpackPlugin({
template: resolve(__dirname, 'src', 'index.html'),
filename: '200.html',
chunks: ['script']
}),
new HtmlWebpackPlugin({
filename: 'prototypes/index.html',
template: 'prototypes/index.html',
chunks: ['prototype']
}),
new HtmlWebpackPlugin({
filename: 'prototypes/main-menu.html',
template: 'prototypes/main-menu.html',
chunks: ['prototype']
}),
new HtmlWebpackPlugin({
filename: 'prototypes/add-solution.html',
template: 'prototypes/add-solution.html',
chunks: ['prototype']
}),
new HtmlWebpackPlugin({
filename: 'prototypes/grades.html',
template: 'prototypes/grades.html',
chunks: ['prototype']
}),
new HtmlWebpackPlugin({
filename: 'prototypes/challenges/1.html',
template: 'prototypes/challenges/1.html',
chunks: ['prototype']
}),
new HtmlWebpackPlugin({
filename: 'prototypes/assess.html',
template: 'prototypes/assess.html',
chunks: ['prototype']
})
],
resolve: {
extensions: ['', '.ts', '.tsx', '.js']
},
devServer: {
inline: true,
contentBase: resolve(__dirname, 'www'),
stats: 'errors-only',
historyApiFallback: true
},
//devtool: "source-map"
}
module.exports = validate(config)