Last active
June 26, 2021 16:36
-
-
Save paveltretyakovru/940da713ba718e58aecfc2868060f6ed to your computer and use it in GitHub Desktop.
To move CRA application to other directory than src (for example to src/frontend folder)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const path = require('path'); | |
const ModuleScopePlugin = require('react-dev-utils/ModuleScopePlugin'); | |
module.exports = { | |
paths: function (paths, env) { | |
paths.appIndexJs = path.resolve(__dirname, 'src/frontend/index.js'); | |
paths.appSrc = path.resolve(__dirname, 'src/frontend'); | |
return paths; | |
}, | |
override(config, env) { | |
config.resolve.plugins = config.resolve.plugins.filter( | |
plugin => !(plugin instanceof ModuleScopePlugin) | |
); | |
return config; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
yarn add --dev customize-cra react-app-rewired |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
// ... | |
"scripts": { | |
"start": "react-app-rewired start", | |
"build": "react-app-rewired build", | |
"test": "react-app-rewired test", | |
"eject": "react-app-rewired eject" | |
}, | |
// ... | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment