isaacplmann / ngx-contextmenu

An Angular component to show a context menu on an arbitrary component
MIT License
248 stars 91 forks source link

SystemJS build with rollup #5

Open isaacplmann opened 7 years ago

isaacplmann commented 7 years ago

From @AnthonyBr on February 15, 2017 17:44

Hello,

When I generate my angular2 project: node_modules\.bin\rollup -c rollup-config.js

I have the error in the title:

?   'ContextMenuComponent' is not exported by node_modules\angular2-contextmenu\
angular2-contextmenu.js

To bundle my project, I use rollup, as described here: https://angular.io/docs/ts/latest/cookbook/aot-compiler.html

As said in the documentation: Rollup can only Tree Shake ES2015 modules which have import and export statements.

And ContextMenuComponent has no export statement.

The project works well when I start the project with systemjs.

Thank you for help, A. Breneliere

Copied from original issue: isaacplmann/angular2-contextmenu#48

isaacplmann commented 7 years ago

You're right. I'm not really sure the best way to export both commonjs (for webpack et al.) and es2015 (for rollup). If you could point me towards another library that does this well or a how-to article, that will help me resolve this.

symbyte commented 7 years ago

On the subject, is there no longer a commonjs export for this module? I'm getting an unexpected token export error now that I'm trying to upgrade from angular2-contextmenu because ngx-contextmenu seems to point to an es6 module by default.

isaacplmann commented 7 years ago

Yes, I think that broke in the migration. I need to figure out how to fix that.