```typescript //打包取到的標識 const NODE_ENV = process.env.NODE_ENV; //測試標識 const DEVELOPMENT_ENV = "development"; //正式標識 const PRODUCTION_ENV = "production"; enum Platform { DEV = "DEV", PROD = "PROD", } interface IPlatformType { [keyName: string]: IPlatformItem; } interface IPlatformItem { name: string; readonly url: string; readonly socketUrl: string; } const isPlatform: string = NODE_ENV == DEVELOPMENT_ENV ? Platform.DEV : Platform.PROD; const PlatformType: IPlatformType = { [Platform.DEV]: { name: Platform.DEV, url: "http://127.0.0.1:8086/", socketUrl: "ws://localhost:8086/", }, [Platform.PROD]: { name: Platform.PROD, url: "https://**********/", socketUrl: "wss://**********/", }, }; export default PlatformType[isPlatform]; ``` 在項目出現這個報錯主要是Platform.DEV下的url:"http://127.0.0.1:8086/"最后面的(/)漏掉了,導致合成的路徑不完整,所以報錯:無效的URL