使用 Rollup 和外部依赖项部署 angular 2 个应用 Aot

Deploying angular 2 app Aot with Rollup and external dependencies

我已经实现了一个 angular 2 应用程序,它利用 Kendo UI Grid:
我在使用 AoT + Rollup 部署应用程序时卡住了:

错误:'GridModule' 未由 node_modules\@progress\kendo-angular-grid\dist\npm\js\main.js 导出(由 app\app.module.js 导入)。

尝试 this 来自 Rollup 文档,但我不明白如何配置 namedExports:

commonjs({
  namedExports: {
    'node_modules/@progress/kendo-angular-grid/dist/npm/js/main.js': [ 'GridModule' ]
  }
});

使用上面的配置没有解决问题。

编辑: 最后我的网格工作配置是:

namedExports: {
            '@progress/kendo-angular-grid': ['GridModule'],
            '@progress/kendo-angular-intl/dist/npm/js/intl.service': ['IntlService'],
            '@progress/kendo-angular-intl/dist/npm/js/cldr-intl.service': ['CldrIntlService'],
            '@progress/kendo-angular-grid/dist/npm/js/grid.module': ['GridModule'],
            '@progress/kendo-angular-grid/dist/npm/js/shared.module': ['SharedModule'],
            '@progress/kendo-angular-grid/dist/npm/js/grid.component': ['GridComponent', 'DEFAULT_SCROLLER_FACTORY'],
            '@progress/kendo-angular-grid/dist/npm/js/browser-support.service': ['BrowserSupportService'],
            '@progress/kendo-angular-grid/dist/npm/js/selection.service': ['SelectionService'],
            '@progress/kendo-angular-grid/dist/npm/js/details.service': ['DetailsService'],
            '@progress/kendo-angular-grid/dist/npm/js/column.component': ['ColumnComponent'],
            '@progress/kendo-angular-grid/dist/npm/js/header-template.directive': ['HeaderTemplateDirective'],
            '@progress/kendo-angular-grid/dist/npm/js/col-group.component': ['ColGroupComponent'],
            '@progress/kendo-angular-grid/dist/npm/js/cell-template.directive': ['CellTemplateDirective'],
            '@progress/kendo-angular-grid/dist/npm/js/header.component': ['HeaderComponent'],
            '@progress/kendo-angular-grid/dist/npm/js/resizable.directive': ['ResizableContainerDirective'],
            '@progress/kendo-angular-grid/dist/npm/js/list.component': ['ListComponent'],
            '@progress/kendo-angular-grid/dist/npm/js/pager.component.js': ['PagerComponent'],
            '@progress/kendo-angular-grid/dist/npm/js/template-context.directive': ['TemplateContextDirective'],
            '@progress/kendo-angular-grid/dist/npm/js/footer.component': ['FooterComponent'],
            '@progress/kendo-angular-grid/dist/npm/js/selectable.directive': ['SelectableDirective'],
            '@progress/kendo-angular-grid/dist/npm/js/table-body.component': ['TableBodyComponent'],
            '@progress/kendo-angular-grid/dist/npm/js/field-accessor.pipe': ['FieldAccessorPipe'],
            '@progress/kendo-angular-grid/dist/npm/js/list.component': ['ListComponent', 'SCROLLER_FACTORY_TOKEN','DEFAULT_SCROLLER_FACTORY']
        }

如果启用了 'include' 部分,它将不起作用

更新(2016 年 12 月 7 日):所有包都更新为导出 ES2015 模块包,因此与 Rollup 的集成应该开箱即用。


2016 年 11 月 7 日: 在撰写本文时,Kendo UI 的 NPM 包 Angular 不提供模块入口点(使用 imports/export),它们是 required for Rollup to work automatically. We plan on introducing them in the future; until they are in place, this problem can be resolved via namedExports.

See the related GitHub issue