Trouble to start the dev server

Author: GuyoSTCreated Sep 18, 2022Updated Aug 30, 2023

Hello every one,

I just installed and configured react-app-rewired, thank you so much because I could split my code as I wanted to.

I had no problem to build the app using npm run build (react-app-rewired build).

But when I try npm start using react-app-rewired start, it stucks on "Starting the development server" and if I try to connect on http://localhost:3000, I get an infinite "pending" on "localhost".

My configuration is working without any trouble when I want to build, I get the app splitted as I wanted and it's working in production.

Here is the configuration if it can helps (just to get one chunk per node_module) :

module.exports = {
    webpack: function override(config, env) {

        config.optimization.runtimeChunk = 'single'

        config.optimization.splitChunks = {
            chunks: 'all',
            maxInitialRequests: Infinity,
            minSize: 0,
            cacheGroups: {
                vendor: {
                    test(module) {
                        return !!module.context && module.context.includes("node_modules")
                    },
                    name(module) {
                        const packageName = module.context.match(/[\\/]node_modules[\\/](.*?)([\\/]|$)/)[1];
                        return `npm.${packageName.replace('@', '')}`;
                    }
                }
            }
        }

        return config;
    },

    devServer: function (configFunction) {
        
        return function (proxy, allowedHost) {
            const config = configFunction(proxy, allowedHost);
            return config;
        };
    },
}

I tried to use react-scripts for npm start and it starts correctly, but I think of course it ignores my code splitting configuration.

So I honestly have no idea if that comes from this react-app-rewired or not, but I post here in case it can help to find a solution for me and for other people who can be in the same situation ?

If you have any advice to get more details to know why it stucks (how to get logs ? or something ?) I would be happy ! If you need more details, just ask me

I'm using for this project : react 17 and react-script 5.0.1

Thank you

Source: timarney/react-app-rewired