Home

Issue: 3067

Decouple Renderer from the Nuxt class

[issue link]

In short: we should move the Renderer out of the Nuxt class to provide a better code flow.


Currently Builder takes a Nuxt instance as argument, and Nuxt embeds Renderer. However, this doesn’t work well because Renderer requires working build artifacts to work. As a result, we end up leaving the Renderer half initialized and later signal the completion of the build:

https://github.com/nuxt/nuxt.js/blob/d1d637f0c4a55fb68895740ceb97b0e92e07fafd/lib/core/renderer.mjs#L75-L77

https://github.com/nuxt/nuxt.js/blob/d1d637f0c4a55fb68895740ceb97b0e92e07fafd/lib/builder/builder.mjs#L514

This kind of data flow makes enhancing the renderer harder. Instead, what we should be doing is to separate the Renderer class, making it similar to the form of the Builder. This is compat breaking, so it’s best to do the refactor while 2.0 is still being dev.

This feature request is available on Nuxt.js community (#c2654)