-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
102 lines (99 loc) · 2.22 KB
/
Copy pathwebpack.config.js
File metadata and controls
102 lines (99 loc) · 2.22 KB
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
90
91
92
93
94
95
96
97
98
99
100
101
102
const path = require('path');
const HTMLWebpackPlugin = require('html-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { NODE_ENV } = process.env;
module.exports = {
mode: NODE_ENV,
entry: './client/index.js',
output: {
path: path.resolve(__dirname, './build'),
filename: 'bundle.js',
// publicPath: '/',
},
module: {
rules: [
{
test: /.jsx?/,
exclude: /node_modules/,
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env', '@babel/preset-react'],
},
},
{
test: /\.s?css/,
use: [MiniCssExtractPlugin.loader, 'css-loader', {
loader: 'sass-loader',
options: {
implementation: require('sass'),
},
}],
},
],
},
resolve: {
extensions: ['.js', '.jsx'],
},
plugins: [
new MiniCssExtractPlugin(),
new HTMLWebpackPlugin({
title: 'Development',
template: path.join(__dirname, './client/index.html'),
}),
],
devServer: {
static: {
publicPath: '/',
directory: path.join(__dirname, './dist'),
},
proxy: {
'/api/**': {
target: 'http://localhost:3000/',
secure: false,
pathRewrite: { '^api': '' },
},
'/assets/**': {
target: 'http://localhost:3000/',
secure: false,
},
'/app/**': {
target: 'http://localhost:3000/',
secure: false,
},
'/auth/**': {
target: 'http://localhost:3000/',
secure: false,
},
'/app/api/auth': {
target: 'http://localhost:3000/',
secure: false,
},
},
hot: true,
compress: true,
port: 8080,
},
optimization: {
splitChunks: {
chunks: 'async',
minSize: 20000,
minRemainingSize: 0,
minChunks: 1,
maxAsyncRequests: 30,
maxInitialRequests: 30,
enforceSizeThreshold: 50000,
cacheGroups: {
defaultVendors: {
test: /[\\/]node_modules[\\/]/,
priority: -10,
reuseExistingChunk: true,
},
default: {
minChunks: 2,
priority: -20,
reuseExistingChunk: true,
},
},
},
},
};