2024-01-02 11:50:54 +08:00
|
|
|
// config.js
|
|
|
|
|
|
2026-02-10 20:46:06 +08:00
|
|
|
const isProduction = import.meta.env.PROD;
|
2024-01-02 11:50:54 +08:00
|
|
|
|
2026-01-15 20:05:00 +08:00
|
|
|
// 从 window 对象获取路径前缀(由后端注入或通过 API 获取)
|
|
|
|
|
const getPathPrefix = () => {
|
|
|
|
|
return window.__URL_PATH_PREFIX__ || '';
|
|
|
|
|
};
|
|
|
|
|
|
2024-01-02 11:50:54 +08:00
|
|
|
const config = {
|
|
|
|
|
apiUrl: isProduction ? '' : 'http://localhost:8000',
|
2026-01-15 20:05:00 +08:00
|
|
|
pathPrefix: getPathPrefix(),
|
2024-01-02 11:50:54 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
export default config;
|
|
|
|
|
|