Search code examples
reactjscreate-react-appreact-scripts

How do I change `src` folder to something else in create-react-app


I'd like to know if it's possible using react-script to rename src to something else like app folder


Solution

  • You can use react-app-rewired to override react paths configuration. In my case, I can change the paths in config-overrides.js file

    const path = require('path');
    
    module.exports = {
        paths: function (paths, env) {        
            paths.appIndexJs = path.resolve(__dirname, 'mysrc/client.js');
            paths.appSrc = path.resolve(__dirname, 'mysrc');
            return paths;
        },
    }