I have a specific use-case, where I only render the pages on the server-side (using Nuxt programatically).
The build time would greatly decrease, if I could just skip building the client-bundle entirely.
Hi @kevcodez
So we agree that you don't need JavaScript at all on your generated pages?
@Atinux Yes. There is no further navigation or whatsoever. Let me elaborate on my specific use-case.
I have an express API, receiving a POST request with some data
{
"template": "invoice",
"data": {
"firstName": "foo",
"lastName": "bar"
}
}
The endpoint then uses nuxt.renderRoute to dynamically render a page:
// Nuxt and express initialization
app.post('/generate', async (req, res, next) => {
await nuxt.ready()
const jsonRequest = req.body
const route = '/' + jsonRequest.template
const {
html,
_error,
_redirected
} = await nuxt.renderRoute(route, {
data: jsonRequest.data
})
res.set('Content-Type', 'text/html')
res.send(html)
})
The API will simply return the generated HTML. That generated HTML is then used to generate a PDF (via headless chrome).
The express API, using Nuxt internally, is deployed using serverless framework.
IMO, I do not need a client bundle since I only render the pages on the server side. This would greatly decrease build time, since I'd only build the server bundle (if possible).
Let me know if I am completely off here. Appreciate any input.
We have been talking with @pi0 and we could introduce build.client option in the nuxt.config.js:
// nuxt.config.js
export default {
build: {
client: false
}
}
@Atinux that would be perfect!
@Atinux What is the status of this? And is there some way to prevent loading the bundle client side in the mean time?
Most helpful comment
We have been talking with @pi0 and we could introduce
build.clientoption in thenuxt.config.js: