-
Notifications
You must be signed in to change notification settings - Fork 1
/
webpack.server.js
46 lines (44 loc) · 1.24 KB
/
webpack.server.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
const path = require('path');
const NodeExternals = require('webpack-node-externals');
const NodemonPlugin = require('nodemon-webpack-plugin');
const CopyPlugin = require('copy-webpack-plugin');
const mode = process.env.NODE_ENV === 'production' ? 'production' : 'development';
module.exports = {
mode,
entry: './server/index.js',
output: {
path: path.resolve(__dirname, 'dist', 'server'),
clean: true
},
module: {
rules: [
{
test: /\.js$/,
use: {
loader: 'babel-loader',
options: {
presets: [
"@babel/preset-env",
],
plugins: [
"@babel/plugin-transform-runtime"
]
}
}
}
]
},
externalsPresets: {
node: true
},
externals: [NodeExternals()],
devtool: 'source-map',
plugins: [
new NodemonPlugin(),
new CopyPlugin({
patterns: [
{ from: path.resolve(__dirname, 'server', 'public'), to: path.resolve(__dirname, 'dist', 'server') }
]
})
]
}