-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
50 lines (46 loc) · 1.3 KB
/
webpack.config.js
File metadata and controls
50 lines (46 loc) · 1.3 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
41
42
43
44
45
46
47
48
49
50
const CopyPlugin = require('copy-webpack-plugin');
const path = require('path') ;
module.exports = {
entry: {
server: path.join(__dirname, 'src/server.ts'),
},
output: {
path: path.join(__dirname, '../dist/server/'),
publicPath: '/',
filename: '[name].js'
},
target: 'node',
resolve: {
// Add '.ts' and '.tsx' as a resolvable extension.
extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js'],
},
node: {
// Need this when working with express, otherwise the build fails
__dirname: false, // if you don't put this is, __dirname
__filename: false, // and __filename return blank or /
},
// externals: [nodeExternals()], // Need this to avoid error when working with Express
module: {
rules: [
{
// Transpiles ES6-8 into ES5
test: /\.tsx?$/,
exclude: /node_modules/,
use: {
loader: 'ts-loader'
}
}
]
},
plugins: [
new CopyPlugin({
patterns: [
{
from: 'src/secrets/cert',
to: 'secrets/cert',
toType: 'dir',
},
],
})
]
};