SolidZORO / next-plugin-antd-less

🎩 Use Antd (Less) with Next.js v12, Zero Dependency on other Next-Plugins.
MIT License
345 stars 48 forks source link

Extremely slow build and hot reload times with Next.js #85

Closed newtonmunene99 closed 2 years ago

newtonmunene99 commented 2 years ago

Sorry, I know this might be a duplicate of #75 but I don't really think that issue was resolved. When I use this plugin the hot reload are incredibly slow, sometimes even 3 - 5 minutes.
Using the plugin isn't nearly productive. I'm spending 70% percent of my time waiting for the hot reloads and only 30% actually writing code.

Do we have any way of optimizing this? Any recommendations?

Here's my next.config.js

const withAntdLess = require("next-plugin-antd-less");

module.exports = withAntdLess({
  lessVarsFilePath: "./src/styles/variables.less",
  reactStrictMode: true,
  webpack(config) {
    return config;
  },
});

And .babelrc.js

// .babelrc.js
module.exports = {
  presets: [["next/babel"]],
  plugins: [["import", { libraryName: "antd", style: true }]],
};
newtonmunene99 commented 2 years ago

Even with the mkn config

// next.config.js

const withPlugins = require("next-compose-plugins");
const withAntdLess = require("next-plugin-antd-less");

const pluginAntdLess = withAntdLess({
  lessVarsFilePath: "./src/styles/variables.less",
});

module.exports = withPlugins([pluginAntdLess], {
  webpack(config) {
    return config;
  },
});
// babel.config.js

module.exports = function (api) {
  api.cache(true);

  return {
    presets: [["next/babel"]],
    plugins: [["import", { libraryName: "antd", style: true }]],
  };
};
SolidZORO commented 2 years ago

@newtonmunene99 Is it solved?

newtonmunene99 commented 2 years ago

@SolidZORO I'm seeing a significant improvement in the hot reload times. Initial build times still a bit slow but it's tolerable now. Thanks