Skip to content

A Q&A platform software for teams at any scales. Whether it's a community forum, help center, or knowledge management platform, you can always count on Apache Answer.

ci(env): optimize env field in .env and .env.production

haitao(lj)4d54cbdec5b0
diff --git a/ui/.env b/ui/.env
index 164bd903..6893217c 100644
--- a/ui/.env
+++ b/ui/.env
@@ -1,2 +1 @@
-REACT_APP_API_URL=/
-REACT_APP_VERSION=
+PUBLIC_URL=
diff --git a/ui/.env.development b/ui/.env.development
index de0cab05..8648d82a 100644
--- a/ui/.env.development
+++ b/ui/.env.development
@@ -1,2 +1 @@
-REACT_APP_API_URL=http://10.0.10.98:206
-REACT_APP_VERSION=
+REACT_APP_API_URL=http://10.0.10.98:2060
diff --git a/ui/.env.production b/ui/.env.production
index 03a22953..940bd4a8 100644
--- a/ui/.env.production
+++ b/ui/.env.production
@@ -1,2 +1,3 @@
-REACT_APP_API_URL=http://10.0.10.98:2060
-CDN_PATH=https://static.segmentfault.com/<projectName>/<version>/
+REACT_APP_API_URL=/
+REACT_APP_PUBLIC_PATH=/
+REACT_APP_VERSION=
diff --git a/ui/.env.test b/ui/.env.test
index aed51498..e69de29b 100644
--- a/ui/.env.test
+++ b/ui/.env.test
@@ -1,2 +0,0 @@
-REACT_APP_LANG = en
-CDN_PATH=https://static-test.segmentfault.com/<projectName>/<version>/
diff --git a/ui/build/index.html b/ui/build/index.html
index 23291f0b..1eec7ed2 100644
--- a/ui/build/index.html
+++ b/ui/build/index.html
@@ -1 +1 @@
-<!doctype html><html><head><meta charset="utf-8"/><link rel="icon" href="./favicon.ico"/></head><body>answer<div id="root"></div></body></html>
+<!doctype html><html><head><meta charset="utf-8"/><link rel="icon" href="/favicon.ico"/><meta name="viewport" content="width=device-width,initial-scale=1"/><meta name="theme-color" content="#000000"/><link rel="manifest" href="/manifest.json"/><title>Answer</title><script defer="defer" src="/static/js/main.1bed8401.js"></script><link href="/static/css/main.6975b122.css" rel="stylesheet"></head><body><noscript>You need to enable JavaScript to run this app.</noscript><div id="root"></div></body></html>
\ No newline at end of file
diff --git a/ui/build/static/README.md b/ui/build/static/README.md
deleted file mode 100644
index e69de29b..00000000
diff --git a/ui/config-overrides.js b/ui/config-overrides.js
index e80ec653..354453e4 100644
--- a/ui/config-overrides.js
+++ b/ui/config-overrides.js
@@ -2,10 +2,9 @@ const path = require('path');
module.exports = {
webpack: function (config, env) {
- if (process.env.NODE_ENV === 'production') {
- config.output.publicPath = process.env.CDN_PATH;
+ if (env === 'production') {
+ config.output.publicPath = process.env.REACT_APP_PUBLIC_PATH;
}
-
config.resolve.alias = {
...config.resolve.alias,
'@': path.resolve(__dirname, 'src'),
diff --git a/ui/package.json b/ui/package.json
index 38e4b291..40d0bd4a 100644
--- a/ui/package.json
+++ b/ui/package.json
@@ -2,7 +2,7 @@
"name": "answer-static",
"version": "0.1.0",
"private": true,
- "homepage": ".",
+ "homepage": "/",
"scripts": {
"start": "react-app-rewired start",
"build:dev": "env-cmd -f .env.development react-app-rewired build",
@@ -108,4 +108,4 @@
"pnpm": ">=7"
},
"license": "MIT"
-}
\ No newline at end of file
+}