在单个文件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
导入会出现相同的错误
帮助表示感谢:)
答案 0 :(得分:0)
npm google api在浏览器中不起作用,因此我将其移至firebase函数中。