-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
62 lines (58 loc) · 1.7 KB
/
webpack.config.js
File metadata and controls
62 lines (58 loc) · 1.7 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
const path = require('path');
const webpack = require('webpack');
require('dotenv').config();
var config = {
entry: {
verify: './src/verify.jsx',
login: './src/login.jsx',
account: './src/account.jsx',
internal: './src/internal.jsx',
'translate-static': './src/translate-static.jsx',
'404': './src/404.jsx',
'pages/index': './src/static_pages/index.jsx',
'pages/legal': './src/static_pages/legal.jsx',
},
output: {
filename: '[name].js',
path: path.resolve(__dirname, 'public', 'js'),
},
devServer: {
port: 8001,
static: path.resolve(__dirname, 'public'),
historyApiFallback: {
rewrites: [
{ from: '\/account\/([\/\\\w\-_]+)(?<!\/\/)$', to: '/account/404.html' },
{ from: '\/internal\/([\/\\\w\-_]+)(?<!\/\/)$', to: '/internal/404.html' },
{ from: '/legal', to: '/legal.html' },
{ from: '/login', to: '/login.html' },
]
}
},
module: {
rules: [
{
test: /\.(jsx)$/,
include: path.resolve(__dirname, 'src'),
use: [
'babel-loader'
]
},
]
},
plugins: [
new webpack.DefinePlugin({
"SECRET": JSON.stringify(process.env.SECRET),
"TURNSTILE_KEY": JSON.stringify(process.env.TURNSTILE_KEY)
}),
],
};
module.exports = (env, argv) => {
if (argv.mode == 'development') {
config.devtool = 'source-map';
config.optimization = {
minimize: false,
mangleExports: false,
};
}
return config;
};