jbty
jbty

Reputation: 195

nuxt.js hot-reload is slow

I want to know if it is normal that nuxt takes 2 or 3 seconds to make the hot reload changes? For example with Gatsby the Hot Reloads are instantaneous. I missed something?

Here is my nuxt build config:

build: {
    parallel: true,
    cache: true,
    extractCSS: process.env.NODE_ENV === 'production',
    optimizeCSS: process.env.NODE_ENV === 'production',
    transpile: ['vue-intersect'],
},

Upvotes: 9

Views: 11493

Answers (2)

Mircea Sirbu
Mircea Sirbu

Reputation: 11

I am happy to report that after manually importing about 300 components in approximately 40 pages for about 15 hours, the HMR (Hot Module Replacement) is slower. It has added approximately 100ms on an M1 computer and around 200-300ms on an Intel computer. Therefore, setting "components: false" does not make the hot reload faster.

Upvotes: 1

Henrique Van Klaveren
Henrique Van Klaveren

Reputation: 1760

I think your problem is because you have a property components setted as true.

  • Nuxt.js 2.13+ can scan and auto import your components. But by default this option in setted with false. You don't need set it to true.

When set to true or using an object, it will include the nuxt/components dependencies and auto import your components (defined in ~/components) when you use them in your templates.

...
// change to false, or remove this config.
components: true
...

Only set to true if you know why you need this property as true. So you can find more about this, in the Nuxt Docs https://nuxtjs.org/api/configuration-components and in the Github docs https://github.com/nuxt/components.

Upvotes: 11

Related Questions