googleapis导入失败,带有typescript / vue / firebase托管

问题描述 投票:0回答:1

在单个文件vue组件中,通过googleapis导入require失败,并显示错误:

Uncaught TypeError: Cannot convert undefined or null to object
at Function.getPrototypeOf (<anonymous>)
at t.exports (index.js:75)
at Object.f447 (index.js:54)
at o (bootstrap:78)
at Object.d465 (jwtclient.js:26)
at o (bootstrap:78)
at Object.<anonymous> (googleauth.js:37)
at Object.0a40 (googleauth.js:640)
at o (bootstrap:78)
at Object.3ccc (index.js:18)

googleapis已经进口了

const { google } = require('googleapis')

如果它是导入的

import { google } from 'googleapis'

然后,第一次调用此google导入时将出现相同的错误

帮助赞赏:)

typescript vue.js google-api firebase-hosting
1个回答
0
投票

npm谷歌apis将无法在浏览器中工作,所以我将该部分移动到firebase功能。

© www.soinside.com 2019 - 2024. All rights reserved.