Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AOT: Unexpected value 'NativeScriptSvgModule'. Please add a @NgModule annotation. #46

Open
jnorkus opened this issue Aug 28, 2019 · 10 comments

Comments

@jnorkus
Copy link

jnorkus commented Aug 28, 2019

I am getting this error when building with AOT option.

ERROR in : Unexpected value 'NativeScriptSvgModule in /Users/jnorkus/code/secret-app/node_modules/@teammaestro/nativescript-svg/angular/nativescript-svg-module.d.ts' imported by the module 'SecretModule in /Users/jnorkus/code/secret-app/app/pages/home/secret/secret.module.ts'. Please add a @NgModule annotation.
@hitmacreed
Copy link

@jnorkus same problem here

@jnorkus
Copy link
Author

jnorkus commented Aug 30, 2019

I found how to fix it. Just build the plugin using ngc command instead of tsc. So in package.json you can change the build script to npm i && ngc.

@hitmacreed
Copy link

@jnorkus im confused can u provide more details ? sample code

@jnorkus
Copy link
Author

jnorkus commented Aug 30, 2019

To make it work you will have to build the plugin yourself instead of using "@teammaestro/nativescript-svg" package. This repo by the looks of it is dead and not supported. What I did was:

  1. Fork this. It has updated native SDKs.
  2. Make changes described above
  3. Create an npm package (optional - you can also copy the built plugin to a local directory and point to it using file:// in your app package.json)

@jnorkus
Copy link
Author

jnorkus commented Aug 30, 2019

I'm afraid I don't have a solution for making it work with "@teammaestro/nativescript-svg" package unless the original developer makes changes and publishes a new version of the package.

But you can always make a local copy of the plugin with the changes I have mentioned.

@jnorkus
Copy link
Author

jnorkus commented Aug 30, 2019

@hitmacreed I have created a public package with the fix. Try this:
npm install @jnorkus/nativescript-svg

@jnorkus
Copy link
Author

jnorkus commented Aug 30, 2019

Remove the teammaestro plugin and use the one I published. That means also changing the imports.
https://github.com/jnorkus/nativescript-svg

@hitmacreed
Copy link

@jnorkus works like a charm thanks

@victorsosa
Copy link
Contributor

@jnorkus PR are welcome

@jnorkus
Copy link
Author

jnorkus commented Aug 30, 2019

@victorsosa I would submit a PR but the codebase in this repo is outdated, so I had to fork a different fork just to make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants