Skip to content
This repository was archived by the owner on Aug 4, 2021. It is now read-only.
This repository was archived by the owner on Aug 4, 2021. It is now read-only.

Can't rollup angular 2 project with commonjs plugin included #100

@danbucholtz

Description

@danbucholtz

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions