-
Notifications
You must be signed in to change notification settings - Fork 5
/
webpack.config.prod.js
78 lines (76 loc) · 1.95 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
import webpack from 'webpack';
import CleanWebpackPlugin from 'clean-webpack-plugin';
import TerserPlugin from 'terser-webpack-plugin';
import OptimizeCSSAssetsPlugin from "optimize-css-assets-webpack-plugin";
import MiniCssExtractPlugin from "mini-css-extract-plugin";
export default {
mode: 'production',
entry: [
'babel-polyfill',
'./src/index.js'
],
plugins: [
//for .env variables
// new Dotenv({
// path: path.resolve(__dirname, './.env')
// }),
new CleanWebpackPlugin(['dist']),
new MiniCssExtractPlugin({
filename: "style.css",
chunkFilename: "chunk.css"
}),
new webpack.EnvironmentPlugin({
NODE_ENV: 'production',
DEBUG: false,
BASE_URL: "https://ah-jumanji-staging.herokuapp.com",
FIREBASE_API_KEY: "AIzaSyDLqlYrfTIkjXb01oA_9svo107jkV-YzAg",
FIREBASE_AUTH_DOMAIN: "ah-jumanji.firebaseapp.com",
SOCIAL_AUTH_API_URL: "https://ah-jumanji-staging.herokuapp.com/api/users/social/auth"
})
],
output: {
filename: 'bundle.js',
path: __dirname + '/dist',
publicPath: '/'
},
optimization: {
minimizer: [
new TerserPlugin({
test: /\.js(\?.*)?$/i,
cache: true,
}),
new OptimizeCSSAssetsPlugin({})
],
},
module: {
rules: [
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
"css-loader"
]
},
{
"test": /\.scss$/,
"use": [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader'],
},
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
"test": /\.(png|jpg|gif)$/,
"use": [
{
"loader": 'file-loader',
"options": {},
},
],
},
]
}
};