Nuxt.js: Pages bundles. How to combine them selectively?

Created on 14 Apr 2017  路  7Comments  路  Source: nuxt/nuxt.js

Hello,
As I understand nuxt bundles every page by default into a separate bundle(app).
How to selectively combine few pages or set not to bundle them separately?

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

Most helpful comment

Ok, I think I have a solution, add this to the build-section of nuxt.config.js:

Edit: I moved it to gist to not bother this thread with changes: https://gist.github.com/rvanzon/6028e884f6735c41125fb2d140143102

All 7 comments

Hi @OlzhasAlexandrov

Nuxt.js is an opinionated framework and will always code-split every route. This behavior cannot be changed I'm sorry.

I'm thinking of a kind of "expert" mode for avoiding the pages directory by creating a router.js file, this way you will have full control of the pages you want to code-split or not.

Thank you for the answer and I'm glad that there is a possibility of adding that mode:)

@Atinux Export mode would be great!!

but for now, is there a hack or something to combine the chunks or reduce the requests? I have 30-requests now on chunks alone, this takes performance down a lot...

Ok, I think I have a solution, add this to the build-section of nuxt.config.js:

Edit: I moved it to gist to not bother this thread with changes: https://gist.github.com/rvanzon/6028e884f6735c41125fb2d140143102

It's an elegant solution you found @rvanzon :-)

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

VincentLoy picture VincentLoy  路  3Comments

mattdharmon picture mattdharmon  路  3Comments

danieloprado picture danieloprado  路  3Comments

vadimsg picture vadimsg  路  3Comments

vadimsg picture vadimsg  路  3Comments