-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.ssr.js
More file actions
39 lines (38 loc) · 1.1 KB
/
webpack.ssr.js
File metadata and controls
39 lines (38 loc) · 1.1 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
const path = require('path');
const webpack = require('webpack');
const nodeExternals = require('webpack-node-externals');
module.exports = (env = {}) => {
const envKeys = Object.keys(env).reduce((prev, next) => {
prev[`process.env.${next}`] = JSON.stringify(env[next]);
return prev;
}, {});
return {
entry: path.resolve(__dirname, 'client/ssr.tsx'),
output: {
path: path.resolve(__dirname, 'server/dist'),
publicPath: '/dist/',
filename: "server.js",
libraryTarget: "umd",
globalObject: "this",
},
target: 'node',
externals: nodeExternals(),
resolve: {
extensions: ['.ts', '.tsx', '.js']
},
module: {
rules: [
{
test: /\.tsx?$/,
exclude: /node_modules/,
use: {
loader: 'awesome-typescript-loader'
}
}
]
},
plugins: [
new webpack.DefinePlugin(envKeys)
]
}
};