我得到一个Unexpected token name «_000», expected punc «,»
,但我的文件看起来有效?任何想法这可能是什么
app/services/API/api.ts
import { ApisauceInstance, create } from "apisauce"
// Use this import if you want to use "env.js" file
// const { API_URL } = require("../../config/env")
// Or just specify it directly like this:
const API_URL = "http://localhost:3000/app" // update later
export class Api {
apisauce: ApisauceInstance
setup() {
this.apisauce = create({
baseURL: API_URL,
timeout: 10_000,
headers: {
Accept: "application/vnd.api+json",
"Content-Type": "application/vnd.api+json",
},
})
}
}
error app/services/api/api.ts: Unexpected token name «_000», expected punc «,» in file app/services/api/api.ts at 27:21.
Error: Unexpected token name «_000», expected punc «,» in file app/services/api/api.ts at 27:21
at minifyCode (/Users/cvdv/ss/mobile/node_modules/metro-transform-worker/src/index.js:99:13)
at transformJS (/Users/cvdv/ss/mobile/node_modules/metro-transform-worker/src/index.js:317:28)
at transformJSWithBabel (/Users/cvdv/ss/mobile/node_modules/metro-transform-worker/src/index.js:408:16)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async Object.transform (/Users/cvdv/ss/mobile/node_modules/metro-transform-worker/src/index.js:569:12)
2条答案
按热度按时间kcwpcxri1#
将
timeout: 10_000,
替换为timeout: 10000,
kiz8lqtg2#
如果不想删除数字分隔符,请升级到
metro-react-native-babel-preset@0.74.1
,或单独安装@babel/plugin-proposal-numeric-separator
并添加到.babelrc
plugins
。