SergeyMell / nativescript-plugins

Apache License 2.0
14 stars 4 forks source link

Support Ivy compilation #22

Open awadeson opened 10 months ago

awadeson commented 10 months ago

Could a change be made which would update @sergeymell/nativescript-svg to support Ivy partial compilation as described in this Angular blog post.

In the codebase I work on, @sergeymell/nativescript-svg is the only dependency that generates this message during build:

ERROR in src/app.module.ts:89:5 - error NG6002: 'NativeScriptSvgModule' does not appear to be an NgModule class.

89     NativeScriptSvgModule,
       ~~~~~~~~~~~~~~~~~~~~~

  node_modules/@sergeymell/nativescript-svg/angular/nativescript-svg-module.d.ts:1:22
    1 export declare class NativeScriptSvgModule {
                           ~~~~~~~~~~~~~~~~~~~~~
    This likely means that the library (@sergeymell/nativescript-svg/angular) which declares NativeScriptSvgModule is not compatible with Angular Ivy. Check if a newer version of the library is available, and update if so. Also consider checking with the library's authors to see if the library is expected to be compatible with Ivy.

webpack 5.89.0 compiled with 1 error in 36577 ms

The availability of SVG plugins for angular & nativescript is quite poor, so this is a really useful library

Thanks in advance

guillemc23 commented 9 months ago

I bumped into the same error while updating to Angular 16. It would be amazing to keep using this plugin! Thank you!

itmor commented 9 months ago

теж те саме, треба виправити цю проблему

R-chie commented 7 months ago

+1

R-chie commented 7 months ago

@awadeson @guillemc23 did you find workaround?

guillemc23 commented 7 months ago

@awadeson @guillemc23 did you find workaround?

Hey @R-chie! I did find a workaround. Instead of importing the module, I'm registering the View, and it works (I have an app in production):

import { registerElement } from "@nativescript/angular";
import { SVGImage } from "@sergeymell/nativescript-svg";
registerElement("SVGImage", () => SVGImage);