当我按照官方 pouchdb 文档中的说明并尝试使用 pouchdb 时,它给我一个错误:
ReferenceError: global is not defined
我特别在 Quasar Vue3 项目中使用 Vite
//package.json
"pouchdb": "^8.0.1",
"quasar": "^2.6.0",
"vue": "^3.0.0",
"vite": "^2.5.10",
Run Code Online (Sandbox Code Playgroud)
代码错误从'pouchdb'导入PouchDB;const dbprueba = new PouchDB('小猫');
显然,发生错误是因为“全局”对象不再在 Vite 中公开,而 pouchdb 引用了该对象。
有谁知道需要对项目进行哪些调整才能解决这个问题?
有谁知道需要对项目进行哪些调整才能解决这个问题?