yarn add react-app-rewired babel-plugin-root-import --dev
"scripts": {
"start": "react-app-rewired start",
"build": "react-app-rewired build",
"test": "react-app-rewired test --env=jsdom"
}const { injectBabelPlugin } = require('react-app-rewired');
const rootImport = ['root-import', {
rootPathPrefix: '~',
rootPathSuffix: 'src',
}];
module.exports = function override(config, env) {
config = injectBabelPlugin(rootImport, config);
return config;
}`~/components/Button'