angular 1.6 と 5 でハイブリッド アプリを実行しようとしています。手動のブートストラップは機能しました。ハイブリッド アプリケーションをブートストラップしようとすると、次のエラーが表示されます。
compiler.js?7e34:466 Uncaught エラー: AppModule のすべてのパラメーターを解決できません: (?)。SyntaxError (eval at (app.bundle.js:1852), :684:34) で CompileMetadataResolver._getDependenciesMetadata (eval at (app.bundle.js:1852), :15765:35) CompileMetadataResolver._getTypeMetadata (eval at ( app.bundle.js:1852)、:15600:26) CompileMetadataResolver.getNgModuleMetadata (eval at (app.bundle.js:1852)、:15399:24) JitCompiler._loadModules (eval at (app.bundle.js: 1852)、:33760:87) JitCompiler._compileModuleAndComponents で (eval at (app.bundle.js:1852)、:33721:36) JitCompiler.compileModuleAsync で (eval at (app.bundle.js:1852)、:33637: 37) CompilerImpl.compileModuleAsync (eval at (app.bundle.js:1864), :245:49) at PlatformRef.bootstrapModule (eval at (app.bundle.js:229), :5646:
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"
]
}
}
ウェブパックを使用しています。これが私の設定の一部です:
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'
},