dzonatan / ngx-linky

Linky pipe for angular
MIT License
41 stars 13 forks source link

AoT compilation fails: Unexpected value 'LinkyModule' imported by the module 'MyModule' when building with ng build --prod --aot #6

Closed marisveide closed 7 years ago

marisveide commented 7 years ago

When I build with Ahead-of-Time compilation, having the following errors:

$ ng build --prod --aot
Could not start watchman; falling back to NodeWatcher for file system events.
Visit http://ember-cli.com/user-guide/#watchman for more info.
  0% compilingUnexpected value 'LinkyModule' imported by the module 'MyModule'
Error: Unexpected value 'LinkyModule' imported by the module 'MyModule'
    at .../node_modules/@angular/compiler/bundles/compiler.umd.js:14326:37
    at Array.forEach (native)
    at CompileMetadataResolver.getNgModuleMetadata (.../node_modules/@angular/compiler/bundles/compiler.umd.js:14311:46)
    at .../node_modules/@angular/compiler/bundles/compiler.umd.js:13284:43
    at Array.forEach (native)
    at _extractModulesAndPipesOrDirectives (.../node_modules/@angular/compiler/bundles/compiler.umd.js:13283:28)
    at analyzeNgModules (.../node_modules/@angular/compiler/bundles/compiler.umd.js:13039:16)
    at OfflineCompiler.compileModules (.../node_modules/@angular/compiler/bundles/compiler.umd.js:13115:20)
    at CodeGenerator.codegen (/Users/iminar/Dev/angular/modules/@angular/compiler-cli/src/codegen.ts:71:26)
    at AotPlugin._make (.../node_modules/@ngtools/webpack/src/plugin.js:186:43)
    at Compiler.<anonymous> (.../node_modules/@ngtools/webpack/src/plugin.js:151:75)
    at Compiler.applyPluginsParallel (.../node_modules/tapable/lib/Tapable.js:156:14)
    at Compiler.<anonymous> (.../node_modules/webpack/lib/Compiler.js:463:8)
    at Compiler.applyPluginsAsync (.../node_modules/tapable/lib/Tapable.js:73:70)
    at Compiler.compile (.../node_modules/webpack/lib/Compiler.js:456:7)
    at Compiler.<anonymous> (.../node_modules/webpack/lib/Compiler.js:219:10)
    at Compiler.readRecords (.../node_modules/webpack/lib/Compiler.js:367:10)
    at Compiler.<anonymous> (.../node_modules/webpack/lib/Compiler.js:216:9)
    at next (.../node_modules/tapable/lib/Tapable.js:81:11)
    at Compiler.<anonymous> (.../node_modules/webpack/lib/CachePlugin.js:34:58)
    at Compiler.applyPluginsAsync (.../node_modules/tapable/lib/Tapable.js:85:13)
    at Compiler.<anonymous> (.../node_modules/webpack/lib/Compiler.js:213:8)
    at next (.../node_modules/tapable/lib/Tapable.js:81:11)
    at Compiler.<anonymous> (.../node_modules/webpack/lib/node/NodeEnvironmentPlugin.js:23:3)
    at Compiler.applyPluginsAsync (.../node_modules/tapable/lib/Tapable.js:85:13)
    at Compiler.run (.../node_modules/webpack/lib/Compiler.js:210:7)
    at .../node_modules/angular-cli/tasks/build-webpack.js:26:29
    at Class.run (.../node_modules/angular-cli/tasks/build-webpack.js:25:16)
    at Class.run (.../node_modules/angular-cli/commands/build.js:50:26)
    at Class.<anonymous> (.../node_modules/angular-cli/lib/models/command.js:152:17)
    at tryCatch (.../node_modules/rsvp/dist/lib/rsvp/-internal.js:215:12)
    at invokeCallback (.../node_modules/rsvp/dist/lib/rsvp/-internal.js:230:13)
    at publish (.../node_modules/rsvp/dist/lib/rsvp/-internal.js:198:7)
    at flush (.../node_modules/rsvp/dist/lib/rsvp/asap.js:85:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

When building with just ng build --prod it all builds just fine. Also, this is the only module that throws this error.

Probably, should make it AoT compatible: https://angular.io/docs/ts/latest/cookbook/aot-compiler.html

brozorec commented 7 years ago

I'm encountering the same issue. @dzonatan that article might be helpful for making your lib compatible with AOT.

dzonatan commented 7 years ago

Hello there! I'll try to make it AoT compatible as soon as possible.

dzonatan commented 7 years ago

Should work now with 1.2.2 version. Let me know if it wont.

marisveide commented 7 years ago

Thanks, man - works like a charm! ;)