-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.ssr.js
36 lines (33 loc) · 932 Bytes
/
webpack.ssr.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
const { resolve } = require('path')
const { merge } = require('webpack-merge')
const nodeExternals = require('webpack-node-externals')
const commonWebpackConfig = require('./webpack.config')
/**
* @type {import('webpack').Configuration}
*/
module.exports = merge(commonWebpackConfig, {
target: 'node',
devtool: '#@source-map',
node: false,
entry: resolve(__dirname, './packages/server/src/index.ts'),
resolve: {
alias: {
'@c': resolve(__dirname, './packages/client/src'),
},
},
externals: nodeExternals({
modulesDir: resolve(__dirname, 'node_modules'),
allowlist: [
/\.(eot|woff|woff2|ttf|otf)$/,
/\.(svg|png|jpg|jpeg|gif|ico|webm)$/,
/\.(mp4|mp3|ogg|swf|webp)$/,
/\.(css|scss|sass|less|styl)$/,
],
}),
output: {
path: resolve(__dirname, './dist/server'),
filename: '[name].js',
chunkFilename: '[name].js',
libraryTarget: 'commonjs2',
},
})