Webpack将“.default”添加到Dexie Plugin导入

时间:2017-12-16 04:52:22

标签: javascript typescript webpack dexie

我正在使用Dexie,我正在尝试使用dexie-relationships插件(https://github.com/ignasbernotas/dexie-relationships)。但是,在包含它并尝试使用它之后,webpack会向其添加.default,这会导致错误,因为模块上没有.default

代码:

import Dexie from 'dexie';
import relationships from 'dexie-relationships'

export class AppDatabase extends Dexie {

    constructor(){
        super('AppDatabase', {addons: [relationships]});
    }
}

什么是网络包输出:

const dexie_1 = __webpack_require__(30);
const dexie_relationships_1 = __webpack_require__(57);
class AppDatabase extends dexie_1.default {
    constructor() {
        super('AppDatabase', { addons: [dexie_relationships_1.default] });
    }
}

dexie_relationships_1.default不起作用,因为dexie_relationships_1是应该传递的函数。

为什么要这样做,我该怎么做才能纠正这种行为?

0 个答案:

没有答案