-
Notifications
You must be signed in to change notification settings - Fork 2
/
webpack.debug.js
60 lines (58 loc) · 1.63 KB
/
webpack.debug.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
import path from 'path';
import { fileURLToPath } from 'url';
import HtmlWebpackPlugin from 'html-webpack-plugin';
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);
export default {
entry: './src/index.js',
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'dist'),
},
resolve: {
extensions: ['.js', '.jsx'],
},
module: {
rules: [
{
test: /\.(js|jsx)$/,
use: 'babel-loader',
exclude: /node_modules/,
},
{
test: /\.css$/,
use: ['style-loader', 'css-loader'],
},
],
},
mode: 'development',
watchOptions: {
ignored: ['node_modules/**', 'dist/**'],
},
performance: {
hints: false,
},
devtool: 'source-map',
devServer: {
historyApiFallback: true,
compress: true,
port: 9002,
static: {
directory: path.join(__dirname, './public'),
},
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',
// This will enable SharedArrayBuffers in Firefox but will block most requests to third-party sites.
"Cross-Origin-Resource-Policy": "cross-origin",
"Cross-Origin-Embedder-Policy": "require-corp",
"Cross-Origin-Opener-Policy": "same-origin"
},
},
plugins: [
new HtmlWebpackPlugin({
template: './public/index.html',
}),
],
};