I am currently in the process of setting up my Angular 8 application to work with server-side rendering (SSR). However, I am encountering some undefined errors in webpack when running my application using ng serve
, especially with lazy-loaded modules. Everything was functioning properly when I was using Angular 7, but after migrating to Angular 8, everything seems to be broken.
ERROR Error: Uncaught (in promise): TypeError: Cannot read property 'call' of undefined
TypeError: Cannot read property 'call' of undefined
at __webpack_require__ (/Users/gwenaellarmet/Documents/Projects/ng-nouma/dist/server.js:137403:30)
at Function.requireEnsure [as e] (/Users/gwenaellarmet/Documents/Projects/ng-nouma/dist/server.js:137422:25)
at ɵ11 (/Users/gwenaellarmet/Documents/Projects/ng-nouma/dist/server.js:139660:6210)
at RouterConfigLoader.loadModuleFactory (/Users/gwenaellarmet/Documents/Projects/ng-nouma/dist/server.js:232758:39)
I have made adjustments to both the tsconfig and angular.json configurations, but I keep encountering the same error consistently. I have disabled Ivy as it was also causing issues during the build process. While I suspect a connection between these problems, I cannot confirm it at this point, so my focus is on getting things to work without Ivy.
ERROR in src/app/pages/search/search.module.ts(68,12): error TS-991010: Value at position 12 in the NgModule.importss of SearchModule is not a reference: [object Object]
src/app/app.module.ts(41,12): error TS-991010: Value at position 6 in the NgModule.importss of AppModule is not a reference: [object Object]
tsconfig.json
... (omitted for brevity)I am compiling my application using npm run build:ssr
and serving it with npm run serve:ssr
. My main goal is to ensure that all modules and markup are rendered with SSR for SEO purposes. Any assistance in pinpointing the root cause of these issues would be greatly appreciated.