Home

Issue: 3034

Core nuxt class should not have side effects on creation

[issue link]

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 🎊, 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).

This question is available on Nuxt.js community (#c2629)