问题
I've implemented an angular 2 app which utilize Kendo UI Grid:
I am stuck when deploying app with AoT + Rollup:
Error: 'GridModule' is not exported by node_modules\@progress\kendo-angular-grid\dist\npm\js\main.js (imported by app\app.module.js).
Tried this from Rollup documentation but I don't understand how to configure namedExports
:
commonjs({
namedExports: {
'node_modules/@progress/kendo-angular-grid/dist/npm/js/main.js': [ 'GridModule' ]
}
});
Using above configuration doesn't solve the problem.
EDIT: finally my working configuration for grid is:
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']
}
It doesn't work if 'include' section is enabled
回答1:
Update (Dec 7, 2016): All packages are updated to export ES2015 module bundles, so integration with Rollup should work out of the box.
Nov 7, 2016: At the time of writing, the NPM packages of Kendo UI for Angular do not provide module entry points (that use imports
/export
), which are 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
来源:https://stackoverflow.com/questions/40423740/deploying-angular-2-app-aot-with-rollup-and-external-dependencies