Angular 2 Aot错误:“ ToastsManager”未导出 [英] Angular 2 Aot Error: 'ToastsManager' is not exported
问题描述
执行AOT时,我正在使用的ng2-toastr遇到问题
While performing AOT I'm facing issue with ng2-toastr which I'm using
ToastsManager' is not exported by 'node_modules\ng2-toastr\src\toast-manager.js
'ToastModule' is not exported by 'node_modules\ng2-toastr\src\toast.module.js'.
'ToastOptions' is not exported by 'node_modules\ng2-toastr\src\toast-options.js'.
关于如何解决此问题的任何想法?我检查了所有提到的文件,它们都带有导出声明关键字,甚至与此网站一起检查了
Any idea on how to resolve this? I checked all those mentioned files, they have export declare keywords with them, even checked with this site
https://github.com/rollup/rollup/wiki/Troubleshooting#name-is-not-exported-by -module
推荐答案
您可以通过更改汇总配置js文件来解决此问题。您需要对commonjs插件配置进行2次更改。
You can solve this by making a change to the rollup config js file. You need to make 2 changes to the commonjs plugin config.
这里是更改后的内容。请注意,您需要同时添加多余的include和namedExports。
Here is mine after the change. Note you need to add both the extra include and the namedExports.
plugins: [
nodeResolve({jsnext: true, module: true}),
commonjs({
include: [
'node_modules/rxjs/**',
'node_modules/ng2-toastr/**'
],
namedExports : {
'node_modules/ng2-toastr/ng2-toastr.js': [ 'ToastModule', 'ToastsManager' ]
}
}),
uglify()
]
这篇关于Angular 2 Aot错误:“ ToastsManager”未导出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!