Javascript – How to update webpack config for a react project created using create-react-app

create-react-appjavascriptreactjswebpack

I have created a react project using create-react-app. Now I need to update the webpack config, but I don't find the file anywhere.
Do I need to create this file myself or what is the process?
I am new to react and not really sure how to proceed from here.

Best Answer

No need to run npm run eject

Step 1

npm install react-app-rewired --save-dev

Step 2

Add config-overrides.js to the project root directory.(NOT ./src)

// config-overrides.js
module.exports = function override(config, env) {
    // New config, e.g. config.plugins.push...
    return config
}

Step 3

Restart your app. Done