-
Notifications
You must be signed in to change notification settings - Fork 34
/
webpack.prod.js
41 lines (40 loc) · 1.4 KB
/
webpack.prod.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
40
41
const path = require('path');
const webpack = require('webpack');
module.exports = (env) => {
return {
entry: './src/index.ts',
module: {
rules: [
{
test: /\.(glsl|vert|frag)$/,
loader: 'ts-shader-loader'
},
{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/,
}
],
},
plugins: [
new webpack.DefinePlugin({
production: true,
TURN_DOMAIN: JSON.stringify(env.TURN_DOMAIN.toString().replace(/\\r/g, "")), //direplace karena perbedaan OS membaca file pada .env file,
TURN_PORT: JSON.stringify(env.TURN_PORT.toString().replace(/\\r/g, "")),
TURN_PORT_TLS: JSON.stringify(env.TURN_PORT_TLS.toString().replace(/\\r/g, "")),
TURN_USERNAME: JSON.stringify(env.TURN_USERNAME.toString().replace(/\\r/g, "")),
TURN_PASSWORD: JSON.stringify(env.TURN_PASSWORD.toString().replace(/\\r/g, "")),
WS_DOMAIN: JSON.stringify(env.WEBSOCKET_DOMAIN.toString().replace(/\\r/g, "")),
WS_PORT: JSON.stringify(env.WEBSOCKET_PORT.toString().replace(/\\r/g, "")),
})
],
resolve: {
extensions: ['.tsx', '.ts', '.js'],
},
output: {
filename: 'bundle.js',
path: path.resolve(__dirname, 'public/dist'),
},
mode: "production" // sementara development karena production tidak mau compile bila typescript ada yg error
};
}