-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.prod.config.js
88 lines (87 loc) · 2.66 KB
/
webpack.prod.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
88
const path = require('path');
const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const HtmlWebpackPluginConfig = new HtmlWebpackPlugin({
template: './src/index.ejs',
filename: 'index.html',
favicon: './src/assets/images/logos/favicon.ico',
inject: 'body',
hash: true,
});
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const webpack = require('webpack');
module.exports = {
entry: ['babel-polyfill', './src/index.js'],
devtool: 'source-map',
output: {
path: path.resolve('dist'),
filename: 'app.js',
publicPath: '/',
},
module: {
loaders: [
{
test: /\.css$/,
loader: 'style-loader!css-loader',
include: /flexboxgrid/
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: 'css-loader?sourceMap!sass-loader?sourceMap'
})
},
{
test: /\.js$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.jsx$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.(woff|woff2|eot|ttf)$/,
loader: 'file-loader?name=fonts/[name].[ext]'
},
{
test: /(\.ico|\.svg|\.png|\.wav|manifest\.json|browserconfig\.xml)$/,
loader: 'file-loader?name=assets/[name].[ext]'
}
]
},
devServer: {
historyApiFallback: true,
},
plugins: [
new webpack.DefinePlugin({
"process.env": {
NODE_ENV: JSON.stringify("production"),
FLUX_API_URI: JSON.stringify(process.env.FLUX_API_URI),
TRAVIS_REPO_SLUG: JSON.stringify(process.env.TRAVIS_REPO_SLUG),
TRAVIS_BRANCH: JSON.stringify(process.env.TRAVIS_BRANCH),
TRAVIS_COMMIT: JSON.stringify(process.env.TRAVIS_COMMIT),
DOKKU_APP_NAME: JSON.stringify(process.env.DOKKU_APP_NAME),
}
}),
new UglifyJSPlugin({
minimize: true,
compress: {
warnings: true
}
}),
HtmlWebpackPluginConfig,
new ExtractTextPlugin({
filename: 'public/style.css',
allChunks: true
})
],
resolve: {
modules: [
path.resolve('src'),
path.resolve('node_modules')
]
},
};