-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.server.config.js
More file actions
31 lines (29 loc) · 876 Bytes
/
webpack.server.config.js
File metadata and controls
31 lines (29 loc) · 876 Bytes
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
const path = require('path');
const webpack = require('webpack');
const nodeExternals = require('webpack-node-externals');
module.exports = {
entry: {
ssr: './src/ssr.tsx'
},
resolve: { extensions: ['.js', '.ts', '.tsx'] },
target: 'node',
// this makes sure we include node_modules and other 3rd party libraries
externals: [/(node_modules|main\..*\.js)/],
output: {
publicPath: "/",
path: root('dist'),
filename: '[name].js',
libraryTarget: "commonjs2"
},
externals: nodeExternals(),
module: {
rules: [
{ test: /\.ts|.tsx$/, loader: 'ts-loader', exclude: root('node_modules'), }
]
}
}
function root(args) {
const _root = path.resolve(__dirname);
args = Array.prototype.slice.call(arguments, 0);
return path.join.apply(path, [_root].concat(args));
};