forked from kiprotect/klaro
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.dev.js
More file actions
73 lines (67 loc) · 1.89 KB
/
Copy pathwebpack.dev.js
File metadata and controls
73 lines (67 loc) · 1.89 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
const webpack = require('webpack');
const path = require('path');
const SRC_DIR = path.resolve(__dirname, 'src');
const WATCH_IGNORED = /[/\\](?:\.git|\.pnpm-store|node_modules)[/\\]/;
const MASKED_EXTENSION_URL = 'webkit-masked-url://hidden/';
function shouldShowRuntimeError(error) {
const message = String(error?.message || error || '');
const stack = String(error?.stack || '');
if (stack.includes(MASKED_EXTENSION_URL)) {
return false;
}
if (message === 'TimeoutError: operation timed out') {
return false;
}
if (message === 'Unknown promise rejection reason') {
return false;
}
return true;
}
module.exports = {
mode: 'development',
devtool: 'inline-source-map',
optimization: {
minimize: false,
},
watchOptions: {
ignored: WATCH_IGNORED,
poll: 1000,
},
plugins: [
new webpack.DefinePlugin({
VERSION: JSON.stringify('development'),
})
],
devServer: {
hot: true,
static: {
directory: path.join(__dirname, 'dist'),
watch: {
ignored: WATCH_IGNORED,
usePolling: true,
interval: 1000,
},
},
historyApiFallback: true,
client: {
overlay: {
errors: true,
warnings: false,
runtimeErrors: shouldShowRuntimeError,
},
},
proxy: [
{
context: ['/api'],
target: 'http://localhost:5000',
secure: false,
},
],
headers: {
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
'Access-Control-Allow-Headers': 'X-Requested-With, content-type, Authorization',
},
allowedHosts: 'all',
}
};