-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathwebpack.config.prod.js
89 lines (80 loc) · 1.96 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
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
88
89
const webpack = require('webpack');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const path = require( 'path' );
const paths = {
entry: path.resolve('./src/index'),
dist: path.resolve('./docs'),
template: path.resolve('./src/index_prod.html'),
favicon: path.resolve('./src/favicon.ico'),
elmMake: path.resolve(__dirname, './node_modules/.bin/elm-make')
}
module.exports = {
devtool: 'eval',
entry: [
paths.entry
],
output: {
pathinfo: true,
path: paths.dist,
filename: 'app-[hash]',
publicPath: './'
},
resolve: {
extensions: ['', '.js', '.elm']
},
module: {
noParse: /\.elm$/,
loaders: [
{
test: /\.elm$/,
exclude: [ /elm-stuff/, /node_modules/ ],
// Use the local installation of elm-make
loader: 'elm-webpack',
query: {
pathToMake: paths.elmMake
}
},
{
test: /\.css$/,
exclude: [ /elm-stuff/, /node_modules/, /assets/ ],
loader: "style-loader!css-loader"
}
]
},
plugins: [
new webpack.DefinePlugin({
API_URL: JSON.stringify('available-languages.json')
}),
new HtmlWebpackPlugin({
inject: true,
title: "Functional programming Babelfish",
template: paths.template,
favicon: paths.favicon,
minify: {
removeComments: true,
collapseWhitespace: true,
removeRedundantAttributes: true,
useShortDoctype: true,
removeEmptyAttributes: true,
removeStyleLinkTypeAttributes: true,
keepClosingSlash: true,
minifyJS: true,
minifyCSS: true,
minifyURLs: true
}
}),
new CleanWebpackPlugin(['docs'], {
verbose: true
}),
// Minify the compiled JavaScript.
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
},
output: {
comments: false
}
}),
]
};