Attempting to transition my AngularJS 1.6 application to Angular 7 using the ngUpgrade route has hit a roadblock. Upon trying to bootstrap my hybrid application, it fails to execute my main.ts file despite being set as the entry point in the webpack configuration.
The HtmlWebpackPlugin is utilizing a template.ejs file as the template. For details on the webpack settings and package.json, please refer to my application bundling and bootstrapping code on GitHub: https://github.com/mmmathur/AngularMigration
Even after attempting to rename main.ts to index.ts, the issue persists.
main.ts
import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
import { UpgradeModule } from '@angular/upgrade/static';
import { AppModule } from '../client/ngApp/ngApp.module';
// Main functionality of the app here...
ngAppModule.ts
import { NgModule } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
// Other imports...
@NgModule({
imports: [
BrowserModule,
// Additional modules...
],
declarations: [
// Components...
],
bootstrap: [
// Entry component...
],
entryComponents: [
]
})
export class AppModule {}
ngApp.component.ts
import { Component } from "@angular/core";
@Component({
selector: 'ng-app',
template: `
<div>
<h2>Angular 7 application bootstraped</h2>
</div>
`
})
export class AppComponent {}
Expected outcome: Successful bootstrapping of my hybrid application.
Current situation: Only a blank screen appears with no errors thrown.
UPDATE Resolution:
optimization:
{
splitChunks: {
chunks: 'all'
}
}
An optimization setting was causing the initial problem, but its removal allowed the application to start bootstrapping. However, a new error emerged that seems related to module instantiation.
UPDATE Continuing the troubleshooting process, I added a polyfills.ts file to address the dependency resolution error, which helped resolve the previous issue. Now, both the AngularJS app and Angular 7 app are bootstrapping simultaneously. Yet, a new error surfaces:
... Error regarding failed module instantiation ...
Any insights on how to navigate this would be appreciated.
Stay tuned for more updates as I work towards resolving this issue.