-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathserver.config.js
More file actions
40 lines (39 loc) · 1.14 KB
/
server.config.js
File metadata and controls
40 lines (39 loc) · 1.14 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
const path = require('path');
const fs = require('fs');
const webpack = require('webpack');
const webpackNodeExternals = require('webpack-node-externals');
const isDev = process.env.NODE_ENV === 'development';
const mode = isDev ? 'development' : 'production';
const pkg = JSON.parse(fs.readFileSync(path.resolve(__dirname, 'package.json')));
const banner =
`${pkg.name} ${pkg.version} <${pkg.homepage}>
Copyright (c) ${(new Date()).getFullYear()} ${pkg.author.name} <${pkg.author.url}>
Released under ${pkg.license} License`;
module.exports = {
context: path.resolve(__dirname, 'src'),
entry: './server.js',
target: 'node',
node: {
__dirname: false,
__filename: false,
},
mode,
output: {
path: path.resolve(__dirname, 'dist/bin'),
filename: "server.bundle.js",
libraryTarget: 'commonjs2'
},
plugins: [
new webpack.BannerPlugin(banner),
],
externals: [webpackNodeExternals()],
module: {
rules: [
{
test: /\.(js)?$/,
exclude: /(node_modules)/,
loader: "babel-loader",
},
]
}
};