Devextreme 与 Angular6 兼容问题解决

按照 Devextreme 的官方文档, 首次使用 devextreme

https://js.devexpress.com/Documentation/Guide/Getting_Started/Widget_Basics_-_Angular/Create_and_Configure_a_Widget/

 

1 创建 Angular项目,   

  ng new test

2 安装 devextreme

  npm install --save devextreme devextreme-angular

3 在 app.module.ts 引用一个按钮

  

import { DxButtonModule } from "devextreme-angular";

@NgModule({
...
imports: [
...
DxButtonModule,
...
]
})
export class AppModule {}

 

4 执行 ng serve 然后出错了

ERROR in ./node_modules/jszip/lib/readable-stream-browser.js

Module not found: Error: Can't resolve 'stream' in 'D:\Project\Work\Quotes2\quotes\node_modules\jszip\lib'

 

查找错误原因, 找到官方的解决方案

{
  ...
  "compilerOptions": {
    ...
    "paths": {
      "jszip": [
        "node_modules/jszip/dist/jszip.min.js"
      ]
    }
  }
}

https://www.devexpress.com/Support/Center/Question/Details/T632535/a-project-s-compilation-fails-with-the-can-t-resolve-stream-error-in-angular-6

 

至此问题解决, 编译通过.

posted @ 2018-09-07 13:26  nepton  阅读(962)  评论(0编辑  收藏  举报