Ionic build browser --prod causes error related to ng2-vs-for library


#1

I’m developing an web app using Ionic 3. I need to use ng2-vs-for library as virtual scroll component because native virtual scroll don’t works well. In development mode the build process goes fine. But when I do a production build, I get this error:

ionic-app-script task: "build"
[13:08:32]  Error: Error encountered resolving symbol values statically. Could not resolve ng2-vs-for relative to
            C:/MyApp/src/app/app.module.ts., resolving symbol AppModule in
            C:/MyApp/src/app/app.module.ts, resolving symbol AppModule in
            C:/MyApp/src/app/app.module.ts
Error: Error encountered resolving symbol values statically. Could not resolve ng2-vs-for relative to C:/MyApp/src/app/app.module.ts., resolving symbol AppModule in C:/MyApp/src/app/app.module.ts, resolving symbol AppModule in C:/MyApp/src/app/app.module.ts
    at Error (native)
    at syntaxError (C:\MyApp\node_modules\@angular\compiler\bundles\compiler.umd.js:1513:34)
    at simplifyInContext (C:\MyApp\node_modules\@angular\compiler\bundles\compiler.umd.js:23316:23)
    at StaticReflector.simplify (C:\MyApp\node_modules\@angular\compiler\bundles\compiler.umd.js:23328:13)
    at StaticReflector.annotations (C:\MyApp\node_modules\@angular\compiler\bundles\compiler.umd.js:22794:60)
    at NgModuleResolver.resolve (C:\MyApp\node_modules\@angular\compiler\bundles\compiler.umd.js:13352:70)
    at CompileMetadataResolver.getNgModuleMetadata (C:\MyApp\node_modules\@angular\compiler\bundles\compiler.umd.js:13937:60)
    at addNgModule (C:\MyApp\node_modules\@angular\compiler\bundles\compiler.umd.js:22526:58)
    at C:\MyApp\node_modules\@angular\compiler\bundles\compiler.umd.js:22537:14
    at Array.forEach (native)

I think it must be related to AOT compiling.

How could I solve this error?