-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.config.prod.js
79 lines (76 loc) · 2.08 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
import webpack from 'webpack';
import path from 'path';
import dotenv from 'dotenv';
dotenv.config({ silent: true });
const processENV = {
NODE_ENV: JSON.stringify('production'),
DEPLOY_URL: JSON.stringify(process.env.DEPLOY_URL),
BASE_URL: JSON.stringify(process.env.BASE_URL),
apiKeyFirebase: JSON.stringify(process.env.FIREBASE_API_KEY),
authDomainFirebase: JSON.stringify(process.env.FIREBASE_AUTH_DOMAIN),
databaseURLFirebase: JSON.stringify(process.env.FIREBASE_DATABASE_URL),
storageBucketFirebase: JSON.stringify(process.env.FIREBASE_STORAGE_BUCKET),
msgSenderIdFirebase: JSON.stringify(process.env.FIREBASE_MSG_SENDER_ID),
};
module.exports = {
debug: true,
devtool: 'source-map',
entry: [
'./tools/assets/animate.351.scss',
'./tools/assets/toastr.213.scss',
'./tools/assets/style.scss',
'./src/index.js',
],
output: {
path: path.resolve('dist'),
publicPath: '/',
filename: 'bundle.js',
},
plugins: [
new webpack.optimize.OccurrenceOrderPlugin(),
new webpack.DefinePlugin({ 'process.env': processENV }),
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
}),
new webpack.optimize.DedupePlugin(),
new webpack.optimize.UglifyJsPlugin(),
],
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.s[ac]ss$/,
loaders: ['style', 'css', 'sass'],
},
{
test: /\.(jpe?g|png|giff|svg|ico)$/i,
loaders: [
'file?hash=sha512&digest=hex&name=[hash].[ext]', {
loader: 'image-webpack-loader',
query: {
mozjpeg: {
progressive: true,
},
gifsicle: {
interlaced: false,
},
optipng: {
optimizationLevel: 4,
},
pngquant: {
quality: '75-90',
speed: 3,
},
},
}],
exclude: /node_modules/,
include: __dirname,
},
],
},
};