fix: use legacy react-scripts
This commit is contained in:
parent
66e02a4bcf
commit
f126d783c9
2
.github/workflows/linux-release.yml
vendored
2
.github/workflows/linux-release.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
||||
run: |
|
||||
cd web
|
||||
npm install
|
||||
VITE_REACT_APP_VERSION=$(git describe --tags) npm run build
|
||||
REACT_APP_VERSION=$(git describe --tags) npm run build
|
||||
cd ..
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
|
2
.github/workflows/macos-release.yml
vendored
2
.github/workflows/macos-release.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
||||
run: |
|
||||
cd web
|
||||
npm install
|
||||
VITE_REACT_APP_VERSION=$(git describe --tags) npm run build
|
||||
REACT_APP_VERSION=$(git describe --tags) npm run build
|
||||
cd ..
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
|
2
.github/workflows/windows-release.yml
vendored
2
.github/workflows/windows-release.yml
vendored
@ -27,7 +27,7 @@ jobs:
|
||||
run: |
|
||||
cd web
|
||||
npm install
|
||||
VITE_REACT_APP_VERSION=$(git describe --tags) npm run build
|
||||
REACT_APP_VERSION=$(git describe --tags) npm run build
|
||||
cd ..
|
||||
- name: Set up Go
|
||||
uses: actions/setup-go@v3
|
||||
|
@ -5,7 +5,7 @@ COPY ./web/package*.json ./
|
||||
RUN npm ci
|
||||
COPY ./web .
|
||||
COPY ./VERSION .
|
||||
RUN VITE_REACT_APP_VERSION=$(cat VERSION) npm run build
|
||||
RUN REACT_APP_VERSION=$(cat VERSION) npm run build
|
||||
|
||||
# Go build stage
|
||||
FROM golang AS builder2
|
||||
|
@ -10,7 +10,7 @@ WORKDIR /build
|
||||
COPY ./web/package*.json ./
|
||||
RUN npm ci
|
||||
COPY --from=translator /app .
|
||||
RUN cd web && VITE_REACT_APP_VERSION=$(cat VERSION) npm run build
|
||||
RUN cd web && REACT_APP_VERSION=$(cat VERSION) npm run build
|
||||
|
||||
# Go build stage
|
||||
FROM golang:1.20.5 AS goBuilder
|
||||
|
@ -10,8 +10,8 @@ npm start
|
||||
npm run build
|
||||
```
|
||||
|
||||
If you want to change the default server, please set `VITE_REACT_APP_SERVER` environment variables before build,
|
||||
for example: `VITE_REACT_APP_SERVER=http://your.domain.com`.
|
||||
If you want to change the default server, please set `REACT_APP_SERVER` environment variables before build,
|
||||
for example: `REACT_APP_SERVER=http://your.domain.com`.
|
||||
|
||||
Before you start editing, make sure your `Actions on Save` options have `Optimize imports` & `Run Prettier` enabled.
|
||||
|
||||
|
16374
web/package-lock.json
generated
16374
web/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@ -9,15 +9,18 @@
|
||||
"react": "^18.2.0",
|
||||
"react-dom": "^18.2.0",
|
||||
"react-dropzone": "^14.2.3",
|
||||
"react-router-dom": "^6.14.1",
|
||||
"react-router-dom": "^6.14.2",
|
||||
"react-scripts": "5.0.1",
|
||||
"react-toastify": "^9.1.3",
|
||||
"react-turnstile": "^1.1.1",
|
||||
"semantic-ui-css": "^2.5.0",
|
||||
"semantic-ui-react": "^2.1.4"
|
||||
},
|
||||
"scripts": {
|
||||
"start": "vite preview",
|
||||
"build": "vite build"
|
||||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"test": "react-scripts test",
|
||||
"eject": "react-scripts eject"
|
||||
},
|
||||
"eslintConfig": {
|
||||
"extends": [
|
||||
@ -38,9 +41,7 @@
|
||||
]
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-react": "^4.0.3",
|
||||
"prettier": "3.0.0",
|
||||
"vite": "^4.4.4"
|
||||
"prettier": "^3.0.0"
|
||||
},
|
||||
"prettier": {
|
||||
"singleQuote": true,
|
||||
|
@ -14,6 +14,5 @@
|
||||
<body>
|
||||
<noscript>You need to enable JavaScript to run this app.</noscript>
|
||||
<div id="root"></div>
|
||||
<script type="module" src="./src/index.jsx"></script>
|
||||
</body>
|
||||
</html>
|
@ -38,7 +38,7 @@ const Footer = () => {
|
||||
) : (
|
||||
<div className='custom-footer'>
|
||||
<a href='https://github.com/songquanpeng/one-api' target='_blank'>
|
||||
{systemName} {import.meta.env.VITE_REACT_APP_VERSION}{' '}
|
||||
{systemName} {process.env.REACT_APP_VERSION}{' '}
|
||||
</a>
|
||||
由{' '}
|
||||
<a href='https://github.com/songquanpeng' target='_blank'>
|
@ -99,7 +99,7 @@ const OtherSetting = () => {
|
||||
'https://api.github.com/repos/songquanpeng/one-api/releases/latest',
|
||||
);
|
||||
const { tag_name, body } = res.data;
|
||||
if (tag_name === import.meta.env.VITE_REACT_APP_VERSION) {
|
||||
if (tag_name === process.env.REACT_APP_VERSION) {
|
||||
showSuccess(`已是最新版本:${tag_name}`);
|
||||
} else {
|
||||
setUpdateData({
|
@ -2,7 +2,7 @@ import { showError } from './utils';
|
||||
import axios from 'axios';
|
||||
|
||||
export const API = axios.create({
|
||||
baseURL: import.meta.env.VITE_REACT_APP_SERVER ? import.meta.env.VITE_REACT_APP_SERVER : '',
|
||||
baseURL: process.env.REACT_APP_SERVER ? process.env.REACT_APP_SERVER : '',
|
||||
});
|
||||
|
||||
API.interceptors.response.use(
|
@ -1,10 +0,0 @@
|
||||
import { defineConfig } from 'vite'
|
||||
import react from '@vitejs/plugin-react'
|
||||
|
||||
// https://vitejs.dev/config/
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
build: {
|
||||
outDir: 'build',
|
||||
},
|
||||
})
|
Loading…
Reference in New Issue
Block a user