【发布时间】:2020-08-04 13:40:50
【问题描述】:
我之前在基于浏览器的项目中使用过 PouchDB,一切正常,但在新的节点项目中,无论我如何导入模块,都会出现此错误
Pouchdb 6.3.4 + @types/pouchdb
import PouchDB from 'pouchdb';
this.userDB = new PouchDB('db');
//TypeError: pouchdb_1.default is not a constructor
结果代码:
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const pouchdb_1 = require("pouchdb");
this.userDB = new pouchdb_1.default('db')
我尝试了所有可能的方式(import =、const =、import * as、import {})
答案(感谢 Mustansir Zia)
const PouchDB = require('pouchdb');
【问题讨论】:
-
哇!很高兴能真正回答。 :)
标签: typescript pouchdb