exclude confing.js fix

This commit is contained in:
maojindao55
2025-07-20 07:45:00 +08:00
parent 78a56c776d
commit 52ace71f62
3 changed files with 9 additions and 7 deletions

View File

@@ -4,7 +4,7 @@
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build",
"build": "vite build && rm -f dist/config.js",
"preview": "vite preview"
},
"dependencies": {

View File

@@ -3,9 +3,12 @@ import { Navigate, useLocation } from 'react-router-dom';
export default function AuthGuard({ children }) {
//判断环境变量中的AUTH_ACCESS是否为1开启权限校验
//const authAccess = import.meta.env.AUTH_ACCESS;
const authAccess = window.APP_CONFIG?.AUTH_ACCESS ||
import.meta.env.AUTH_ACCESS ||
'0';
let authAccess = window.APP_CONFIG?.AUTH_ACCESS || '0';
const isCf = import.meta.env.IS_CF || '0';
console.log(isCf, 'isCf');
if (isCf === '1') {
authAccess = import.meta.env.AUTH_ACCESS || '0';
}
console.log(authAccess, 'authAccess');
if (authAccess === '1') {
const location = useLocation();

View File

@@ -8,6 +8,5 @@ binding = "bgdb" # available in your Worker on env.DB
database_name = "friends"
database_id = "f68e9fa5-4aea-45db-9516-2d7052e936fa"
[site]
bucket = "./dist"
exclude = ["config.js"]
[vars]
IS_CF = '1'