Static GitHub Issues

[3034] Core nuxt class should not have side effects on creation

prev: How to refresh the nuxt page? If the page is refreshed with location.reload (), the page looks like the beauty center rendering asyncData does not appear to be executed
next: Cannot find a way to create endpoints ?

Right now, the Nuxt class has an async side effect in the constructor. This (with the combination of being cached) makes it very hard to extend. You should instead have to run the await nuxt.ready() function be called by the parent.

https://github.com/nuxt/nuxt.js/blob/1080dfdbd678e41dc1af8b45ea3edac55fad2f2d/lib/core/nuxt.js#L40

Personal use case

I am currently moving an old express app to use nuxt with SSR :confetti_ball:, but I need to keep backwards compatibility, which includes falling back to a proxy when no route is matched. To do this, I'm creating a new Nuxt class, rebinding the connect app to the already existing express app, and then removing the last middleware (error handling / 404 page).

<!--cmty--><!--cmty_prevent_hook--><div align="right"><sub><em>This question is available on <a href="https://nuxtjs.cmty.io">Nuxt.js</a> community (<a href="https://nuxtjs.cmty.io/nuxt/nuxt.js/issues/c2629">#c2629</a>)</em></sub></div>