Gbuomprisco / ngx-chips

Tag Input component for Angular
MIT License
899 stars 359 forks source link

Missing .metadata.json files (Ionic2 integration) #98

Closed yolier closed 7 years ago

yolier commented 7 years ago

Hi,

I'm currently trying to integrate the ng2-tag-input modul into an Ionic2 project of mine and I encountered some problems doing that. The problem occures if I want to build the project for the android platform. If I only run it in the browser everything works just fine. If I start an android build with ionic build android I get the following error:

[22:39:05]  Error: Unexpected value 'TagInputModule' imported by the module 'AppModule' 
[22:39:05]  ngc failed 
[22:39:05]  ionic-app-script task: "build" 
[22:39:05]  Error: Error 

npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "ionic:build"
npm ERR! node v6.9.1
npm ERR! npm  v3.10.8
npm ERR! code ELIFECYCLE
npm ERR! Project@ ionic:build: ionic-app-scripts build
npm ERR! Exit status 1
...

I suspect the problem is that the .metadata.json files are missing that ngc requires at build. A similar problem is described here: https://github.com/gevgeny/angular2-highcharts/issues/75

The .metadata.json files apperently can be auto-generated by ngc as stated here: https://github.com/angular/angular/issues/11262 . Would it be possible to generate those for the ng2-tag-input module and add them to the project?

Thanks in advance.

Gbuomprisco commented 7 years ago

Hi @YoLieR,

Sure I'll have a look

alihbuzaid commented 7 years ago

I have the same exact issue ... any workaround ?? any solutions ?

thanks ,,

DODMax commented 7 years ago

I'm running into the same problem. Probably a duplicate of https://github.com/Gbuomprisco/ng2-tag-input/issues/65 According to this thread the package would need to be compiled by ngc first in order to generate a required index.metadata.json file.

rajshrimohanks commented 7 years ago

@Gbuomprisco You can simply solve this by compiling your code using ngc and then bundling it for release. That should generate the required *.metadata.json files. Without them, AOT is not possible when we add your library into our code and that's a huge downer...

Gbuomprisco commented 7 years ago

Hi @rajshrimohanks, I understand that. Unfortunately it is not too easy as I am using require() all over the place and unfortunately they cannot be used with AOT, so I will need to change those first. Sorry for the delay, I'm bombarded with issues and it's difficult to fix them all :) Do feel free to open a PR if you are able to make it work on your env, it would be huge help

Gbuomprisco commented 7 years ago

Hi,

the package has been updated to be working with AOT. Unfortunately I haven't been able yet to test with some AOT ready boilerplates (some 3rd party always complains, it seems).

Please reopen this if still not working :)

DODMax commented 7 years ago

Hi,

Thanks for taking the time, really looking forward to use this component in my Ionic2 project. For now I have the following error when compiling:

[12:03:21]  Error: Error at
            D:/dev/xampp/htdocs/socialc/socialc_ionic/.tmp/node_modules/ng2-tag-input/dist/modules/components/tag-input-form/tag-input-form.component.ngfactory.ts:296:48
[12:03:21]  Property 'onKeyDown' is private and only accessible within class 'TagInputForm'.
[12:03:21]  Error at
            D:/dev/xampp/htdocs/socialc/socialc_ionic/.tmp/node_modules/ng2-material-dropdown/dist/src/modules/components/dropdown/ng2-dropdown.ngfactory.ts:50:48
[12:03:21]  Property 'scrollListener' is private and only accessible within class 'Ng2Dropdown'.
[12:03:21]  Error at
            D:/dev/xampp/htdocs/socialc/socialc_ionic/.tmp/node_modules/ng2-material-dropdown/dist/src/modules/components/menu-item/ng2-menu-item.ngfactory.ts:135:40
[12:03:21]  Property 'button' does not exist on type 'Ng2MenuItem'.
[12:03:21]  Error at
            D:/dev/xampp/htdocs/socialc/socialc_ionic/.tmp/node_modules/ng2-tag-input/dist/modules/components/tag-input.ngfactory.ts:193:20
[12:03:21]  Property 'onTextChangeDebounce' is private and only accessible within class 'TagInputComponent'.
[12:03:21]  Error at
            D:/dev/xampp/htdocs/socialc/socialc_ionic/.tmp/node_modules/ng2-tag-input/dist/modules/components/tag-input.ngfactory.ts:200:20
[12:03:21]  Property 'inputId' is private and only accessible within class 'TagInputComponent'.
[12:03:21]  Error at
            D:/dev/xampp/htdocs/socialc/socialc_ionic/.tmp/node_modules/ng2-tag-input/dist/modules/components/tag-input.ngfactory.ts:207:20
[12:03:21]  Property 'inputClass' is private and only accessible within class 'TagInputComponent'.
[12:03:21]  Error at
            D:/dev/xampp/htdocs/socialc/socialc_ionic/.tmp/node_modules/ng2-tag-input/dist/modules/components/tag-input.ngfactory.ts:222:48
[12:03:21]  Property 'scrollListener' is private and only accessible within class 'TagInputComponent'.
[12:03:21]  Error at
            D:/dev/xampp/htdocs/socialc/socialc_ionic/.tmp/node_modules/ng2-tag-input/dist/modules/components/tag-input.ngfactory.ts:423:44
[12:03:21]  Property 'hasCustomTemplate' is private and only accessible within class 'TagInputComponent'.
[12:03:21]  Error at
            D:/dev/xampp/htdocs/socialc/socialc_ionic/.tmp/node_modules/ng2-tag-input/dist/modules/components/tag-input.ngfactory.ts:426:46
[12:03:21]  Property 'hasCustomTemplate' is private and only accessible within class 'TagInputComponent'.
[12:03:21]  ngc failed
[12:03:21]  ionic-app-script task: "build"
[12:03:21]  Error: Error

I'll try to look into it although I'm not so sure where to start :-)

Gbuomprisco commented 7 years ago

mhm I wonder if in Ionic - the properties used in templates need to be public? I never used it :|

abdel-ships-it commented 7 years ago

@Gbuomprisco Actually all properties you will use in the template, need to be public. See this response by a member of the ionic team on an issue related to your questions.

Gbuomprisco commented 7 years ago

@realappie yeah. Originally it wasn't the case I guess