Hello,
I'm experiencing some challenges trying to rollup an Angular 2 project if I include commonjs plugin in my list of plugins. When I run rollup, I get the following error message:
'import' and 'export' may only appear at the top level (24:0) in /Users/dan/Dev/ionic2-app-base-sample/node_modules/@angular/core/src/facade/lang.js
However, that file is an ESM file, so there isn't an import or export on that line. Angular 2 has the module value set to point to esm modules. I am unclear about what exactly is going on. However, if I remove the commonjs plugin, I do not see this issue.
Steps to recreate:
[email protected]:driftyco/ionic2-app-base.git
git checkout rollup-test
npm install
npm run build
This is a very simple "starter" project for ionic framework. It is very much in flux right now so I apologize for that. Rollup is ultimately run from ./config/rollup/rollup.script.js. The npm run build script does some compilation, than runs rollup to bundle the source code and dependencies together. With the commonjs plugin included, you'll see an error and the process quit.
Everything works as expected if we remove the commonjs plugin. However, we want to be able to use this plugin because so many existing libraries are distributed in commonjs, and we want to keep it simple for our users.
Please let me know if you have any suggestions of how I can resolve this myself or how I can help the rollup team.
Thanks,
Dan
Hello,
I'm experiencing some challenges trying to rollup an Angular 2 project if I include commonjs plugin in my list of plugins. When I run rollup, I get the following error message:
'import' and 'export' may only appear at the top level (24:0) in /Users/dan/Dev/ionic2-app-base-sample/node_modules/@angular/core/src/facade/lang.jsHowever, that file is an ESM file, so there isn't an import or export on that line. Angular 2 has the
modulevalue set to point to esm modules. I am unclear about what exactly is going on. However, if I remove the commonjs plugin, I do not see this issue.Steps to recreate:
This is a very simple "starter" project for ionic framework. It is very much in flux right now so I apologize for that. Rollup is ultimately run from
./config/rollup/rollup.script.js. Thenpm run buildscript does some compilation, than runs rollup to bundle the source code and dependencies together. With the commonjs plugin included, you'll see an error and the process quit.Everything works as expected if we remove the commonjs plugin. However, we want to be able to use this plugin because so many existing libraries are distributed in commonjs, and we want to keep it simple for our users.
Please let me know if you have any suggestions of how I can resolve this myself or how I can help the rollup team.
Thanks,
Dan