Skip to content
This repository was archived by the owner on Aug 7, 2021. It is now read-only.
This repository was archived by the owner on Aug 7, 2021. It is now read-only.

Reflect Metadata issue - DI error when build with nativescript-dev-webpack@next - Can't resolve all parameters for Component #660

Closed

Description

@NickIliev

The issue occurs only when building with next modules, angular and webpack. The CLI build is working as expected while the Webpack build is failing with dependency injection error. The issue is also not reproducible with the master branch.

Steps to reproduce:

  • Use this branch from the POC app (tns-core-modules, nativescript-angular and nativescript-dev-webpack set to next)
  • Build with
tns run android --bundle

Error log

 Error: Can't resolve all parameters for LoginComponent: (?, ?, ?, ?).
System.err: File: "file:///data/data/org.nativescript.curiosity/files/app/vendor.js, line: 19242, column: 12
System.err:
System.err: StackTrace:
System.err:     Frame: function:'ZoneAwareError', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 66399, column: 33
System.err:     Frame: function:'syntaxError', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 9153, column: 17
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver._getDependenciesMetadata', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 19054, column: 35
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver._getTypeMetadata', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 18947, column: 26
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.getNonNormalizedDirectiveMetadata', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 18566, column: 24
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver._getEntryComponentMetadata', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 19150, column: 28
System.err:     Frame: function:'', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 19141, column: 31
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver._getEntryComponentsFromProvider', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 19140, column: 30
System.err:     Frame: function:'', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 19113, column: 138
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver._getProvidersMetadata', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 19076, column: 19
System.err:     Frame: function:'', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 19078, column: 23
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver._getProvidersMetadata', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 19076, column: 19
System.err:     Frame: function:'', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 18699, column: 118
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.getNgModuleMetadata', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 18690, column: 49
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.getNgModuleSummary', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 18625, column: 35
System.err:     Frame: function:'', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 18712, column: 55
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.CompileMetadataResolver.getNgModuleMetadata', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 18690, column: 49
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._loadModules', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 32008, column: 51
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler._compileModuleAndComponents', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 31989, column: 36
System.err:     Frame: function:'push.../node_modules/@angular/compiler/fesm5/compiler.js.JitCompiler.compileModuleAsync', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 31949, column: 37
System.err:     Frame: function:'push.../node_modules/@angular/platform-browser-dynamic/fesm5/platform-browser-dynamic.js.CompilerImpl.compileModuleAsync', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 51976, column: 31
System.err:     Frame: function:'push.../node_modules/@angular/core/fesm5/core.js.PlatformRef.bootstrapModule', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 37439, column: 25
System.err:     Frame: function:'_bootstrapper', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 62152, column: 66
System.err:     Frame: function:'', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 62209, column: 19
System.err:     Frame: function:'push.../node_modules/tns-core-modules/data/observable/observable.js.Observable.notify', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 88956, column: 23
System.err:     Frame: function:'notifyLaunch', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 106608, column: 17
System.err:     Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.setActivityContent', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 106541, column: 28
System.err:     Frame: function:'push.../node_modules/tns-core-modules/ui/frame/frame.js.ActivityCallbacksImplementation.onCreate', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 106415, column: 14
System.err:     Frame: function:'push.../node_modules/tns-core-modules/ui/frame/activity.js.NativeScriptActivity.onCreate', file:'file:///data/data/org.nativescript.curiosity/files/app/vendor.js', line: 104505, column: 25

Activity

  1. added
    nextThe problem is only with a prerelease version.
    on Sep 17, 2018
  2. NickIliev commented on Sep 18, 2018

    @NickIliev
    ContributorAuthor

    Reverting nativescript-angular (but still using next webpack and next modules). to 6.1.0 resolves the issue

    Update: reverting the changes from this commit seems to resolve the issue.

  3. NickIliev commented on Sep 19, 2018

    @NickIliev
    ContributorAuthor

    The issue is happening only in JIT and not when using AOT.

    Solution:

    Manually importing the reflect-metadata plugin at the top of main.ts file is resolving the issue

    main.ts

    import "reflect-metadata";
    
    // more code follows here
  4. changed the title [-]DI error when build with nativescript-dev-webpack@next - Can't resolve all parameters for Component[/-] [+]Reflect Metadata issue - DI error when build with nativescript-dev-webpack@next - Can't resolve all parameters for Component[/+] on Oct 2, 2018
  5. vchimev commented on Jan 16, 2019

    @vchimev
    Contributor
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    backlogbugnextThe problem is only with a prerelease version.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions