craco icon indicating copy to clipboard operation
craco copied to clipboard

devServer() is executed twice

Open BugCreators opened this issue 3 years ago • 1 comments

craco.config.js like this

module.exports = {
  devServer: (devServerConfig, { env, paths, proxy, allowedHost }) => {
    devServerConfig.client.overlay.errors = false;

    // other...

    return devServerConfig;
  },
};

It works in 7.0.0-alpha.3, but when i upgrade to 7.0.0-alpha.7, I got the following error

(node:18104) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'overlay' of undefined

and i add console.log("devServerConfig", devServerConfig)

devServerConfig {}
devServerConfig {
  ...some configuration
}

As you see the function is called twice and the first time devServerConfig is empty

Is it expected behaviour?

BugCreators avatar Jul 27 '22 03:07 BugCreators

I just looked into it and it looks like this is a bug that I can fix. I will do that as soon as I can. Thanks for bearing with me as I work on this update and for catching this bug!

dilanx avatar Jul 27 '22 06:07 dilanx

Just fixed this. It'll be in effect in alpha 8 which will be released sometime this week.

dilanx avatar Oct 02 '22 06:10 dilanx