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
|
const nodeExternals = require('webpack-node-externals')
const path = require('path')
module.exports = {
devtool: false,
entry: {
'server': [
path.resolve(__dirname, 'index.js')
]
},
target: 'node',
output: {
path: path.resolve(__dirname, '../../public'),
filename: '[name].js',
},
module: {
rules: [{
test: /\.js$/,
exclude: [
/node_modules/
],
loader: 'babel-loader'
}, {
test: /\.(png|jpe?g|gif|svg)$/i,
type: 'asset/resource',
dependency: { not: ['url'] },
}]
},
plugins: [
],
resolve: {
symlinks: false,
extensions: ['.js']
},
externalsPresets: { node: true }, // in order to ignore built-in modules like path, fs, etc.
externals: [nodeExternals({
allowlist: [/\.(?!(?:jsx?|json)$).{1,5}$/i]
})],
}
|