Saturday 22 April 2017

How to deal with barrel imports in node_modules using SystemJS 0.19?

I am struggeling with importing one of my dependencies during aot-build using SystemJS (19.47).

The library I try to import is ng2-tag-input. However when building the project with aot it complains about not finding included files due to wrong resolution if barrel imports.

Error on fetch for ng2-tag-input/dist/modules/components/icon.js at file:///P:/Repositories/workspace_angular2/node_modules/ng2-tag-input/dist/modules/components/icon.js Loading ng2-tag-input/dist/modules/ng2-tag-input.module.js Loading dist\tmp\app\app.module.ngfactory.js Loading dist\tmp\app\main-prod.js ENOENT: no such file or directory, open 'P:\Repositories\workspace_angular2\node_modules\ng2-tag-input\dist\modules\components\icon.js'

the right path would be icon/icon.js

I have tried to apply the mapping to my systemjs config as described here How to import a barrel by folder name only? and already opened a ticket here https://github.com/Gbuomprisco/ng2-tag-input/issues/331

so far no success. I would really like to understand why it does not work. For me it's not very clear at the moment what is exactly causing the problem.

I would really appreciate any help or idea how to solve the issue :)

Best, Patrick



via Patrick P.

No comments:

Post a Comment