Skip to content
This repository was archived by the owner on Feb 20, 2024. It is now read-only.

Commit 0572ba0

Browse files
committed
Fix injection of admin host & port for dev environment
1 parent 1c9b388 commit 0572ba0

File tree

3 files changed

+58
-4
lines changed

3 files changed

+58
-4
lines changed

web/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@
66
"author": "nginyc",
77
"license": "Apache-2.0",
88
"scripts": {
9-
"build": "webpack --config webpack.config.js",
10-
"dev": "webpack-dev-server --open --config webpack.config.js"
9+
"build": "webpack --config webpack.config.prod.js",
10+
"start": "node app.js",
11+
"dev": "webpack-dev-server --open --config webpack.config.dev.js"
1112
},
1213
"dependencies": {
1314
"@material-ui/core": "^3.3.2",

web/webpack.config.js renamed to web/webpack.config.dev.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ module.exports = {
2121
plugins: [
2222
new CleanWebpackPlugin(['dist']),
2323
new webpack.DefinePlugin({
24-
'process.env.NODE_ENV': JSON.stringify('development'),
25-
'process.env.VERSION': JSON.stringify(packageJson.version)
24+
'window.ADMIN_HOST': JSON.stringify(process.env.RAFIKI_ADDR),
25+
'window.ADMIN_PORT': JSON.stringify(process.env.ADMIN_EXT_PORT)
2626
})
2727
],
2828
module: {

web/webpack.config.prod.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
const webpack = require('webpack');
2+
const packageJson = require('./package.json');
3+
const CleanWebpackPlugin = require('clean-webpack-plugin');
4+
5+
module.exports = {
6+
mode: 'production',
7+
devtool: 'source-map',
8+
entry: {
9+
app: [
10+
'./src/index.tsx'
11+
]
12+
},
13+
resolve: {
14+
extensions: [".ts", ".tsx", ".js", ".json"]
15+
},
16+
output: {
17+
path: __dirname + '/dist',
18+
filename: 'bundle.js',
19+
publicPath: __dirname + '/dist'
20+
},
21+
plugins: [
22+
new CleanWebpackPlugin(['dist'])
23+
],
24+
module: {
25+
rules: [
26+
{
27+
test: /\.tsx?$/,
28+
loader: "awesome-typescript-loader",
29+
exclude: /node_modules/
30+
},
31+
{
32+
test: /\.js?$/,
33+
loader: "source-map-loader"
34+
},
35+
{
36+
test: /\.(png|svg|jpg|gif)$/,
37+
use: ["file-loader"]
38+
},
39+
{
40+
test: /\.(woff|woff2|eot|ttf|otf)$/,
41+
use: ["file-loader"]
42+
}
43+
]
44+
},
45+
// When importing a module whose path matches one of the following, just
46+
// assume a corresponding global variable exists and use that instead.
47+
// This is important because it allows us to avoid bundling all of our
48+
// dependencies, which allows browsers to cache those libraries between builds.
49+
externals: {
50+
"react": "React",
51+
"react-dom": "ReactDOM"
52+
}
53+
};

0 commit comments

Comments
 (0)