harlan-zw / nuxt-webpack-optimisations

Make your Nuxt.js webpack builds faster ⚡
269 stars 8 forks source link

Can i disabled this module in dev mode ? #39

Closed nasirDoe closed 2 years ago

nasirDoe commented 2 years ago

Is your feature request related to a problem? Please describe. Because when i ran in dev mode, my site is broken.

Screen Shot 2022-02-21 at 09 30 27

Thanks

harlan-zw commented 2 years ago

Hey @nasirDoe

Each optimisation can be disabled conditionally. It may be worth going through the features and seeing which one is breaking the site. Seems like it could be the postcss one

export default {
  webpackOptimisations: {
    features: {
      // this could fix it 
      postcssNoPolyfills: false,
      // change true to false for each one until things start working
      esbuildLoader: true,
      esbuildMinifier: true,
      imageFileLoader: true,
      webpackOptimisations: true,
      cacheLoader: true,
      hardSourcePlugin: false,
      parallelPlugin: false,
    }
  }
}

Otherwise to have optimisations only work in dev you can see the example in the read me.

 webpackOptimisations: {
    // hard source is the riskiest, if you have issues don't enable it
    hardSourcePlugin: process.env.NODE_ENV === 'development',
    parallelPlugin: process.env.NODE_ENV === 'development',
  }
nasirDoe commented 2 years ago

thanks @harlan-zw for your answer. it's helps