【问题标题】:Error importing "dexie-export-import" in Angular在 Angular 中导入“dexie-export-import”时出错
【发布时间】:2019-09-01 23:44:53
【问题描述】:

我正在尝试将 dexie-export-import 与 Angular 一起使用。但我收到错误 Module not found: Error: Can not resolve 'stream' in 'xxx\node_modules\ dexie-export-import\dist'。我已经尝试并搜索了不同的方法,但我真的找不到让它工作的方法。

我正在使用 angular 7.2、dexie 2.0.4 和 dexie-export-import 1.0.0-alpha.9

import Dexie from 'dexie';
import 'dexie-export-import';

export class TestDatabase extends Dexie {
  testTable: Dexie.Table<PersistableTest, number>;

  constructor() {
    super('test-database');
    this.version(1).stores({
      testTable: '++id'
    });

    this.testTable.mapToClass(PersistableTest);

    this.export();
  }
}

【问题讨论】:

    标签: angular dexie


    【解决方案1】:

    似乎是汇总脚本的问题。

    我刚刚在 npm 上发布了一个不应该包含流依赖的新版本。试试:

    npm install dexie-export-import@1.0.0-alpha.10
    

    如果解决了请告诉我!

    【讨论】:

    • 好了,这样就解决了依赖问题!我现在遇到的问题是它在运行时出错,因为它找不到导出方法。即使基于原始问题的相同代码。我发现的一种解决方案是在 tsconfig 的 compilerOprions / 路径中添加 "dexie-export-import": ["node_modules/dexie-export-import/dist/dexie-export-import.js"]。 json文件,这样好吗?
    猜你喜欢
    • 2020-06-22
    • 1970-01-01
    • 2020-12-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-26
    • 1970-01-01
    • 2015-07-17
    相关资源
    最近更新 更多