Universal: Support for Angular 8

Created on 11 Jun 2019  路  12Comments  路  Source: angular/universal

Are you planning support Angular 8?
If yes, when you're planning to release version with it?

Currently I have to update angular vr to 8 to fix something and I'm blocked because I get warning about version of angular.

Most helpful comment

Are there any angular contributors/members that could weigh in on this?

This is blocking me from upgrading to angular 8 as well, not because anything appears broken, but that I don't wish to risk it without some kind of statement.

If Ivy support is the only issue, given it is disabled by default and still in beta/preview stage it would seem reasonable to me to release a version 8 of universal with the caveat that Ivy isn't supported.

All 12 comments

A statement as to the current status regarding Angular 8 and Universal would be appreciated as I can't find one if this exists.

I don't know if there is an official support but there is a 8.0.0-rc1 version released 2 weeks ago. I've tested it, it works fine on my app.

i tested with angular 8 it works but without ivy enabled

Is there any kind of installation / updating guide for this rc1 version though? (I didn't even know if there's support for v8 already anyway) I'm stuck with my updated Angular 8 version with the universal sources bound to version 7.*

Hi
Repository: https://github.com/Aeonrush/angular8-universal-bug
OR

npx -p @angular/cli ng new test-app

Would you like to add Angular routing? Yes

npx ng add @nguniversal/express-engine --clientProject test-app

Add

npx ng g c test
npx ng g m pages/about
npx ng g c pages/about

In src/app/app-routing.module.ts

const routes: Routes = [
  { path: 'page', loadChildren: () => import('./pages/about/about.module').then((M) => M.AboutModule) },
  { path: 'test', component: TestComponent }
];

In src/app/pages/about/about.module.ts

  imports: [
    CommonModule,
    RouterModule.forChild([
      { path: 'about', component: AboutComponent }
    ])
  ]

package.json

"@angular/animations": "~8.0.1",
"@angular/common": "~8.0.1",
"@angular/compiler": "~8.0.1",
"@angular/core": "~8.0.1",
"@angular/forms": "~8.0.1",
"@angular/platform-browser": "~8.0.1",
"@angular/platform-browser-dynamic": "~8.0.1",
"@angular/platform-server": "~8.0.1",
"@angular/router": "~8.0.1",
"@nguniversal/express-engine": "^7.0.2",
"@nguniversal/module-map-ngfactory-loader": "v7.0.2",

npm run build:ssr was successfully done. npm run serve:ssr was started successfully. If I open http://localhost:4000/test everything is ok. But if I open http://localhost:4000/page/about I got an error

ERROR { Error: Uncaught (in promise): TypeError: Cannot read property 'call' of undefined
TypeError: Cannot read property 'call' of undefined
    at __webpack_require__ (/home/alexander/Documents/test-app/dist/server.js:137852:30)
    at Function.requireEnsure [as e] (/home/alexander/Documents/test-app/dist/server.js:137871:25)
    at 傻0 (/home/alexander/Documents/test-app/dist/server.js:138003:38)
    at RouterConfigLoader.loadModuleFactory (/home/alexander/Documents/test-app/dist/server.js:142299:39)
    at RouterConfigLoader.load (/home/alexander/Documents/test-app/dist/server.js:142284:35)
    at MergeMapSubscriber.project (/home/alexander/Documents/test-app/dist/server.js:141287:47)
    at MergeMapSubscriber._tryNext (/home/alexander/Documents/test-app/dist/server.js:37086:27)
    at MergeMapSubscriber._next (/home/alexander/Documents/test-app/dist/server.js:37076:18)
    at MergeMapSubscriber.Subscriber.next (/home/alexander/Documents/test-app/dist/server.js:33598:18)
    at Observable._subscribe (/home/alexander/Documents/test-app/dist/server.js:35668:20)
    at resolvePromise (/home/alexander/Documents/test-app/dist/server.js:1000:31)
    at resolvePromise (/home/alexander/Documents/test-app/dist/server.js:957:17)
    at /home/alexander/Documents/test-app/dist/server.js:1061:17
    at ZoneDelegate.invokeTask (/home/alexander/Documents/test-app/dist/server.js:571:31)
    at Object.onInvokeTask (/home/alexander/Documents/test-app/dist/server.js:28543:33)
    at ZoneDelegate.invokeTask (/home/alexander/Documents/test-app/dist/server.js:570:60)
    at Zone.runTask (/home/alexander/Documents/test-app/dist/server.js:343:47)
    at drainMicroTaskQueue (/home/alexander/Documents/test-app/dist/server.js:749:35)
    at ZoneTask.invokeTask (/home/alexander/Documents/test-app/dist/server.js:650:21)
    at Server.ZoneTask.invoke (/home/alexander/Documents/test-app/dist/server.js:635:48)
  rejection:

@Aeonrush Update your tsconfig.server.json to:

{
  "extends": "./tsconfig.json",
  "compilerOptions": {
    "outDir": "../out-tsc/app",
    "baseUrl": "./",
    "module": "commonjs",
    "types": []
  },
  "exclude": [
    "test.ts",
    "**/*.spec.ts"
  ],
  "angularCompilerOptions": {
    "entryModule": "src/app/app.server.module#AppServerModule"
  }
}

Hi
Thank you @naturalfreak it's works. Actually add "module": "commonjs" fix issue for me.
Final config

{
  "extends": "./tsconfig.app.json",
  "compilerOptions": {
    "outDir": "./out-tsc/app-server",
    "module": "commonjs"
  },
  "angularCompilerOptions": {
    "entryModule": "./src/app/app.server.module#AppServerModule"
  }
}

Thank you again

Are there any angular contributors/members that could weigh in on this?

This is blocking me from upgrading to angular 8 as well, not because anything appears broken, but that I don't wish to risk it without some kind of statement.

If Ivy support is the only issue, given it is disabled by default and still in beta/preview stage it would seem reasonable to me to release a version 8 of universal with the caveat that Ivy isn't supported.

@naturalfreak can you look into this issue as well, giving error in node console, but working fine in browser #https://github.com/angular/angular/issues/31249

There is now a v8 release available: https://github.com/angular/universal/releases

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings