-
Notifications
You must be signed in to change notification settings - Fork 7
/
webpack.server.js
39 lines (38 loc) · 1.02 KB
/
webpack.server.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
37
38
39
const path = require('path');
const libraryName = 'redcube.node';
const nodeExternals = require('webpack-node-externals');
module.exports = {
mode: 'development',
target: 'node',
externals: [nodeExternals()],
entry: path.join(__dirname, `/src/${libraryName}.ts`),
output: {
filename: `${libraryName}.js`,
chunkFilename: '[name].js',
path: path.join(__dirname, '/dist'),
library: libraryName,
libraryTarget: 'umd',
umdNamedDefine: true
},
devServer: {
publicPath: '/dist/'
},
devtool: process.env.NODE_ENV === 'development' && 'source-map',
resolve: { extensions: ['.ts', '.js'] },
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader'
},
{
test: /\.(glsl|vert|frag)$/,
type: 'asset/source'
},
{
test: /\.(jpeg|jpg|png|gif)$/,
type: 'asset/inline'
}
]
}
};