2017-11-27 1 views
5

각도 1.6과 5의 하이브리드 앱을 실행하려고합니다. 수동 부트 스트랩이 효과적이었습니다. 마자 하이브리드 응용 프로그램을 부트 스트랩을 시도, 나는 다음과 같은 오류 얻을 :앱 모듈의 매개 변수를 확인할 수 없습니다.

compiler.js?7e34:466 Uncaught Error: Can't resolve all parameters for AppModule: (?). at syntaxError (eval at (app.bundle.js:1852), :684:34) at CompileMetadataResolver._getDependenciesMetadata (eval at (app.bundle.js:1852), :15765:35) at CompileMetadataResolver._getTypeMetadata (eval at (app.bundle.js:1852), :15600:26) at CompileMetadataResolver.getNgModuleMetadata (eval at (app.bundle.js:1852), :15399:24) at JitCompiler._loadModules (eval at (app.bundle.js:1852), :33760:87) at JitCompiler._compileModuleAndComponents (eval at (app.bundle.js:1852), :33721:36) at JitCompiler.compileModuleAsync (eval at (app.bundle.js:1852), :33637:37) at CompilerImpl.compileModuleAsync (eval at (app.bundle.js:1864), :245:49) at PlatformRef.bootstrapModule (eval at (app.bundle.js:229), :5646:25) at eval (eval at (app.bundle.js:827), :76:53)

app.ts

platformBrowserDynamic().bootstrapModule(AppModule);

app.module.ts

import {NgModule} from '@angular/core'; 
import {BrowserModule} from '@angular/platform-browser'; 
import {UpgradeModule} from '@angular/upgrade/static'; 

@NgModule({ 
    imports: [ 
     BrowserModule, 
     UpgradeModule 
    ] 
}) 
export class AppModule { 
    constructor(private upgrade: UpgradeModule) { 
    } 

    ngDoBootstrap() { 
     this.upgrade.bootstrap(document.documentElement, ['myApp']); 
    } 
} 

tsconfig.json

{ 
    "compileOnSave": false, 
    "compilerOptions": { 
    "outDir": "./dist/out-tsc", 
    "sourceMap": true, 
    "declaration": false, 
    "module": "commonjs", 
    "emitDecoratorMetadata": true, 
    "experimentalDecorators": true, 
    "target": "es5", 
    "typeRoots": [ 
     "node_modules/@types" 
    ], 
    "lib": [ 
     "es2017", 
     "dom" 
    ] 
    } 
} 

나는 webpack을 사용하고 있습니다. 여기에 내 설정의 일부가 있습니다 :

resolve: { 
    extensions: ['.js', '.ts'], 
    alias: { 
     "@angular/upgrade/static": "@angular/upgrade/bundles/upgrade-static.umd.js" 
    } 
}, 

module: { 
    rules: [ 
     { 
      test: /\.ts$/, 
      loader: 'ts-loader', 
      exclude: '/node_modules' 
     }, 

답변

0

모든 코드를 공유하는 한, 순서대로있는 것 같습니다. Angular의 데코레이터와 충돌하는 또 다른 주석 라이브러리를 사용하고있을 수도 있습니다. 예를 들어, angular-ts-decorators을 사용한다면 확실히 그런 문제가 발생할 것입니다.

이 경우 - 다른 어노테이션 라이브러리 (어쨌든 중복 될 것임)를 제거하고 대신 앵귤러의 주석을 사용하십시오.

관련 문제