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' },
如果是这种情况 – 删除其他注释库(现在应该是冗余的)并使用Angular的注释.