-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
57 lines (56 loc) · 1.35 KB
/
webpack.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
const Dotenv = require('dotenv-webpack');
const path = require('path');
const webpack = require('webpack');
const dotEnv = require('dotenv-webpack');
const CompressionPlugin = require("compression-webpack-plugin");
module.exports = {
mode: "development",
entry: path.join(__dirname, "/client/src/index.jsx"),
output: {
filename: "bundle.js",
path: path.join(__dirname, "/client/dist/"),
},
module: {
rules: [
{
test: /\.(js|jsx)?/,
exclude: /(node_modules|bower_components)/,
use: {
loader: "babel-loader",
options: {
presets: [
'@babel/preset-env',
['@babel/preset-react', {runtime: 'automatic'}],
]
}
},
},
{
test: /\.(js|jsx)$/,
exclude: /(node_modules|bower_components)/,
loader: 'babel-loader',
options: { presets: ['@babel/env', '@babel/preset-react'] },
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.(png|svg|jpg|gif)$/,
loader: "file-loader",
}
],
},
plugins: [
new dotEnv({
ignoreStub: true,
}),
new CompressionPlugin({
filename: "[path][base].gz",
algorithm: "gzip",
test: /\.js$|\.css$|\.html$/,
threshold: 10240,
minRatio: 0.8,
}),
],
};