wwwalkerrun / nativescript-ngx-magic

Magically drop a NativeScript app into your Angular web app and reuse all your code.
MIT License
48 stars 8 forks source link

Incompatible with Angular 5: `Error: Unexpected value 'AppComponent' declared by the module 'AppModule'. Please add a @Pipe/@Directive/@Component annotation.` #19

Open KeithGillette opened 6 years ago

KeithGillette commented 6 years ago

I have been using nativescript-ngx-magic through Angular 4.x but get a browser console error of the form Error: Unexpected value 'AppComponent' declared by the module 'AppModule'. Please add a @Pipe/@Directive/@Component annotation. for any component decorated with @Component imported from './plugin/decorators/magic.component' rather than from '@angular/core'. I have recreated this error by pulling this repository and upgrading the Angular dependencies to 5.0.1.

besch commented 6 years ago

I am also having issue setting up project on Angular 5.

` Installing NativeScript Angular Template... Command npm install https://github.com/NathanWalker/template-hello-world-ng.git --silent --save-exact --save failed with exit code 1 child_process.js:524 throw err; ^

Error: Command failed: tns create nativescript --template https://github.com/NathanWalker/template-hello-world-ng.git Command npm install https://github.com/NathanWalker/template-hello-world-ng.git --silent --save-exact --save failed with exit code 1

at checkExecSyncError (child_process.js:481:13)
at Object.execSync (child_process.js:521:13)
at Object.<anonymous> (/Users/user/project/node_modules/@wwwalkerrun/nativescript-ngx-magic/install.js:45:8)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:389:7)

`

KeithGillette commented 6 years ago

It appears that this repository & approach to code-sharing between an Angular Web & NativeScript application are no longer maintained. I see that the angular-seed-advanced project in which package used to be used has switched to using the stock @angular/core @Component decorator and processing the shared controller via a Gulp task for the NativeScript build. This also seems to be the approach of the simpler angular-native-seed. In a recent thread on angular-seed-advanced, the package author now recommends using abstract base classes instead of directly sharing decorated component controllers.