Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ngx 编译无法通过 #8

Open
victory-wu opened this issue Sep 11, 2020 · 0 comments
Open

ngx 编译无法通过 #8

victory-wu opened this issue Sep 11, 2020 · 0 comments

Comments

@victory-wu
Copy link

victory-wu commented Sep 11, 2020

版本
angular8
"echarts": "^4.9.0",
ngx-echarts": "^5.1.2",

方式一:

import echarts from 'echarts';

@NgModule({
  imports: [
    NgxEchartsModule.forRoot({
      echarts: echarts
    })
  ]
})
export class StatisticModule { }

编译后使用浏览器出现错误:
main.642581c9bf05d0fd9d9e.js:2 ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'init' of null
TypeError: Cannot read property 'init' of null

开发模式下能正常使用

方式二:


@NgModule({
  imports: [
    NgxEchartsModule.forRoot({
      echarts: () => import('echarts')    <= line: 26
    })
  ]
})
export class StatisticModule { }

代码无法通过编译

ERROR in Error during template compile of 'StatisticModule'
Function expressions are not supported in decorators in 'ɵ0'
'ɵ0' contains the error at app/statistic/statistic.module.ts(26,16)
Consider changing the function expression into an exported function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant