d-kostov-dev / ng2-mdf-validation-messages

Angular 2 Model Driven Forms Validation Messages
MIT License
11 stars 8 forks source link

When i try to run the Prod Build, i am getting error. #12

Open Wolf00Bomber opened 7 years ago

Wolf00Bomber commented 7 years ago

I am using this lib to validate forms. All is working fine when i do a normal build for Android. But when i do the Prod Build, i am seeing this error:

Error: Error encountered resolving symbol values statically. Calling function 'Ng2MDFValidationMessagesModule', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol AppModule in E:/Ionic Projects/App-Mobileapp/V.1/src/app/app.module.ts, resolving symbol AppModule in E:/Ionic Projects/App-Mobileapp/V.1/src/app/app.module.ts at Error (native) at syntaxError (E:\Ionic Projects\App-Mobileapp\V.1\node_modules\@angular\compiler\bundles\compiler.umd.js:1550:34) at simplifyInContext (E:\Ionic Projects\App-Mobileapp\V.1\node_modules\@angular\compiler\bundles\compiler.umd.js:23870:23) at StaticReflector.simplify (E:\Ionic Projects\App-Mobileapp\V.1\node_modules\@angular\compiler\bundles\compiler.umd.js:23882:13) at StaticReflector.annotations (E:\Ionic Projects\App-Mobileapp\V.1\node_modules\@angular\compiler\bundles\compiler.umd.js:23331:41) at NgModuleResolver.resolve (E:\Ionic Projects\App-Mobileapp\V.1\node_modules\@angular\compiler\bundles\compiler.umd.js:13883:70) at CompileMetadataResolver.getNgModuleMetadata (E:\Ionic Projects\App-Mobileapp\V.1\node_modules\@angular\compiler\bundles\compiler.umd.js:14473:60) at addNgModule (E:\Ionic Projects\App-Mobileapp\V.1\node_modules\@angular\compiler\bundles\compiler.umd.js:23050:58) at E:\Ionic Projects\App-Mobileapp\V.1\node_modules\@angular\compiler\bundles\compiler.umd.js:23061:14 at Array.forEach (native) [DEBUG] Error: Error encountered resolving symbol values statically. Calling function 'Ng2MDFValidationMessagesModule',

kunal-dethe-v2sol commented 6 years ago

Instead of using it as:

imports: [
    ...
    Ng2MDFValidationMessagesModule.globalConfig({...})
    ...
]

use it as:

providers: [
    ...
    {
        provide: Ng2MDFValidationMessagesModule,
        useValue: {...}
    }
    ...
]

It will stop giving you that error.

nexstreamray commented 6 years ago

@d-kostov-dev I get another issue when compiling production with AOT. ERROR in : Unexpected value 'Ng2MDFValidationMessagesModule in .../node_modules/ng2-mdf-validation-messages/dist/module.d.ts' imported by the module 'UserModule in ...'. Please add a @NgModule annotation.

Do you have any clue what's going on?