cor*_*ese 5 firebase typescript next.js vercel
我有一个 nextjs 和 firebase 应用程序设置,具有功能,并且所有内容都可以在本地完美运行和构建。但是,当我构建并部署到 Vercel 时,我在 Vercel 控制台中收到以下构建错误:
类型错误:找不到模块“firebase-functions”或其相应的类型声明。
这是我的应用程序/功能 package.json
{
"name": "functions",
"scripts": {
"lint": "eslint --ext .js,.ts .",
"build": "tsc",
"serve": "npm run build && firebase emulators:start --only functions",
"shell": "npm run build && firebase functions:shell",
"start": "npm run shell",
"deploy": "firebase deploy --only functions",
"logs": "firebase functions:log"
},
"engines": {
"node": "16"
},
"main": "lib/index.js",
"dependencies": {
"axios": "^0.26.1",
"firebase": "^9.6.11",
"firebase-admin": "^10.0.2",
"firebase-functions": "^3.18.0"
},
"devDependencies": {
"@typescript-eslint/eslint-plugin": "^5.12.0",
"@typescript-eslint/parser": "^5.12.0",
"eslint": "^8.9.0",
"eslint-config-google": "^0.14.0",
"eslint-plugin-import": "^2.25.4",
"firebase-functions-test": "^0.2.0",
"typescript": "^4.5.4"
},
"private": true
}
Run Code Online (Sandbox Code Playgroud)
我通过修改文件解决了这个问题tsconfig.json
。我将“函数”添加到“排除”数组中。
"exclude": ["node_modules", "functions"]
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
1856 次 |
最近记录: |