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

rstormsf picture rstormsf · Jun 9, 2017 · Viewed 25.4k times · Source

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

Answer

Cong Dan Luong picture Cong Dan Luong · Feb 11, 2019

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;
    },
}