Skip to content

Commit bbb4578

Browse files
authored
Merge pull request #44 from david-macpherson/BF_Prod_Dev_WEBSOCKET_URL
Bug Fix: Setting the WEBSOCKET_URL var prod and dev
2 parents bc4ebc4 + bb31116 commit bbb4578

File tree

5 files changed

+25
-17
lines changed

5 files changed

+25
-17
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ node_modules/
33
types/
44
.vscode
55
!.env.example
6-
.env
6+
*.env

examples/typescript/webpack.common.js

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,12 @@
11
const path = require('path');
22
const HtmlWebpackPlugin = require('html-webpack-plugin');
3-
const webpack = require('webpack');
4-
require('dotenv').config({ path: './.env' });
3+
require('dotenv').config({ path: './.env' });
54

65
module.exports = {
76
entry: {
87
index: './src/index.ts',
98
},
109
plugins: [
11-
new webpack.DefinePlugin({
12-
WEBSOCKET_URL: JSON.stringify((process.env.WEBSOCKET_URL !== undefined) ? process.env.WEBSOCKET_URL : '')
13-
}),
1410
new HtmlWebpackPlugin({
1511
title: 'Scalable Pixel Streaming Frontend',
1612
template: './src/index.html',

examples/typescript/webpack.dev.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,14 @@
11
const { merge } = require('webpack-merge');
22
const common = require('./webpack.common.js');
33
const path = require('path');
4+
const webpack = require('webpack');
45

56
module.exports = merge(common, {
67
mode: 'development',
78
devtool: 'source-map',
8-
});
9+
plugins: [
10+
new webpack.DefinePlugin({
11+
WEBSOCKET_URL: JSON.stringify((process.env.WEBSOCKET_URL !== undefined) ? process.env.WEBSOCKET_URL : undefined)
12+
}),
13+
]
14+
});
Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,20 @@
11
const { merge } = require('webpack-merge');
22
const common = require('./webpack.common.js');
3+
const webpack = require('webpack');
34

45
module.exports = merge(common, {
5-
mode: 'production',
6-
optimization: {
7-
usedExports: true,
8-
minimize: true
9-
},
10-
stats: 'errors-only',
11-
performance: {
12-
hints: false
13-
}
6+
mode: 'production',
7+
optimization: {
8+
usedExports: true,
9+
minimize: true
10+
},
11+
stats: 'errors-only',
12+
performance: {
13+
hints: false
14+
},
15+
plugins: [
16+
new webpack.DefinePlugin({
17+
WEBSOCKET_URL: undefined
18+
}),
19+
]
1420
});

library/src/SPSApplication.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export class SPSApplication extends Application {
6161
this.stream.setSignallingUrlBuilder(() => {
6262

6363
// if we have overriden the signalling server URL with a .env file use it here
64-
if (WEBSOCKET_URL) {
64+
if (WEBSOCKET_URL !== undefined ) {
6565
return WEBSOCKET_URL as string;
6666
}
6767

0 commit comments

Comments
 (0)