在单个文件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
导入时将出现相同的错误
帮助赞赏:)
npm谷歌apis将无法在浏览器中工作,所以我将该部分移动到firebase功能。