Fix/base url (#212)

* env is updated

* webpack config is updated

* webpack config is updated

* dotenv-expanded is removed

* vars is updated

* env is updated

* docker ignore is updated

* webpack config is updated

* dev and build is updarted with the progress arguments

* config is updated
This commit is contained in:
Palash gupta 2021-07-29 17:35:43 +05:30 committed by GitHub
parent a3c1080519
commit 3e8c9308b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 26 additions and 12 deletions

View File

@ -1,3 +1,4 @@
node_modules
.vscode
build
.env

View File

@ -4,9 +4,9 @@
"description": "",
"main": "webpack.config.js",
"scripts": {
"dev": "NODE_ENV=development webpack serve",
"dev": "NODE_ENV=development webpack serve --progress",
"start": "node scripts/start.js",
"build": "webpack --config=webpack.config.prod.js",
"build": "webpack --config=webpack.config.prod.js --progress",
"prettify": "prettier --write .",
"lint": "eslint src"
},
@ -54,7 +54,6 @@
"d3-flame-graph": "^3.1.1",
"d3-tip": "^0.9.1",
"dotenv": "8.2.0",
"dotenv-expand": "5.1.0",
"eslint": "^7.29.0",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-flowtype": "^5.2.0",

View File

@ -1,3 +1,3 @@
export const ENVIRONMENT = {
baseURL: "",
baseURL: process?.env?.FRONTEND_API_ENDPOINT || "",
};

11
frontend/src/typings/environment.d.ts vendored Normal file
View File

@ -0,0 +1,11 @@
declare global {
namespace NodeJS {
interface ProcessEnv {
FRONTEND_API_ENDPOINT: string | undefined;
}
}
}
// If this file has no import/export statements (i.e. is a script)
// convert it into a module by adding an empty export statement.
export {};

View File

@ -1,6 +1,11 @@
// shared config (dev and prod)
const { resolve } = require("path");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const dotenv = require("dotenv");
const webpack = require("webpack");
dotenv.config();
console.log(resolve(__dirname, "./src/"));
module.exports = {
@ -56,6 +61,9 @@ module.exports = {
},
plugins: [
new HtmlWebpackPlugin({ template: "src/index.html.ejs" }),
new webpack.DefinePlugin({
"process.env": JSON.stringify(process.env),
}),
],
performance: {
hints: false,

View File

@ -46,7 +46,7 @@ module.exports = {
},
plugins: [
new CompressionPlugin({
exclude: /.map$/
exclude: /.map$/,
}),
new HtmlWebpackPlugin({ template: "src/index.html.ejs" }),
new CopyPlugin({

View File

@ -5472,11 +5472,6 @@ dot-case@^3.0.4:
no-case "^3.0.4"
tslib "^2.0.3"
dotenv-expand@5.1.0:
version "5.1.0"
resolved "https://registry.yarnpkg.com/dotenv-expand/-/dotenv-expand-5.1.0.tgz#3fbaf020bfd794884072ea26b1e9791d45a629f0"
integrity sha512-YXQl1DSa4/PQyRfgrv6aoNjhasp/p4qs9FjJ4q4cQk+8m4r6k4ZSiEyytKG8f8W9gi8WsQtIObNmKd+tMzNTmA==
dotenv@8.2.0:
version "8.2.0"
resolved "https://registry.yarnpkg.com/dotenv/-/dotenv-8.2.0.tgz#97e619259ada750eea3e4ea3e26bceea5424b16a"