Ionic-app-scripts: Barrel stopped working after scripts update.

Created on 6 Oct 2016  路  12Comments  路  Source: ionic-team/ionic-app-scripts

We are using Angular barrel for file imports, and as our project is already quite huge, we cannot totally refactor it.
It stopped working after yesterday's Adam's commit: https://github.com/driftyco/ionic-app-scripts/commit/556d2e37dd6b84154b224592751e5f50f9e2a309

and now we are getting:
Error: Module .../ionic/src/app/index.ts does not export ComponentData (imported by .../src/components/module-components/module-component/module-component.ts) at Module.trace (.../node_modules/rollup/dist/rollup.js:7706:29)

when I am switching back to the rollup conf, that contained ngTemplate() plugin, it works again.

bug

Most helpful comment

Interesting update: @masatada mentions in the issue referenced above that it only occurs when using the interface to type an @Input. I can confirm that this is also the case with me.

So @jgw96 you should be able to reproduce this problem now.

I'm setting the erroring @Input types to any for now.

All 12 comments

Hello, thanks for using Ionic! Could you provide an example of the line that is causing this error?

@kleeb s ComponentData an interface? I had the same problem with interfaces that are never implemented getting stripped where I depended on them for type checking.

Yes, ComponentData is an interface, that is put in the barrel.
However when I tried importing it straight, rollup was saying that it hasn't been exported (like when export was missing before interface, but its there). As I wrote, this is not causing the bundle not to build when I am switch back to ngTemplate plugin.

@kleeb Would you mind sharing a repo that we can use to reproduce this issue?

@jgw96 will do my best to reproduce on some smaller piece of code and share it, will get back asap

This is the same problem as mentioned by others in #64: interfaces that are used for type checking and are never implemented are removed, throwing an error. This is unrelated to barrels and also happens when importing directly. cc @10freefingers

I cannot reproduce it on smaller project.

From around 100 interfaces only 1 was causing problem.
I just changed it to become a class, and it fixed the issue.

Probably some inheritance and usage of those interfaces in some special way inside template is causing problems.

I had the same problem with interfaces that are never implemented getting stripped where I depended on them for type checking.

Interesting update: @masatada mentions in the issue referenced above that it only occurs when using the interface to type an @Input. I can confirm that this is also the case with me.

So @jgw96 you should be able to reproduce this problem now.

I'm setting the erroring @Input types to any for now.

I'm also seeing this with @Inject, so it's probably related to decorators in general.

Look like its fixed with Ionic RC1 + Angular 2.1.0.

Same here!

Was this page helpful?
0 / 5 - 0 ratings