After npx create-react-app, modifying webpack.config.js inside /node_modules/react-scripts... does not work

229 Views Asked by At

My goal is to change svgo module's config the way that it does not remove id tags from svg file while importing it.

I have App.js:

import React from 'react'; import logo from './logo.svg'; import './App.css'; import { ReactComponent as Complex} from './simple.svg';

function App() { return ( ); }

export default App;

This is the svg related block inside my webpack.config.js:

...........................

{ test: /\.(js|mjs|jsx|ts|tsx)$/, include: paths.appSrc, loader: require.resolve('babel-loader'), options: { customize: require.resolve( 'babel-preset-react-app/webpack-overrides' ), presets: [ [ require.resolve('babel-preset-react-app'), { runtime: hasJsxRuntime ? 'automatic' : 'classic', }, ], ], // @remove-on-eject-begin babelrc: false, configFile: false, // Make sure we have a unique cache identifier, erring on the // side of caution. // We remove this when the user ejects because the default // is sane and uses Babel options. Instead of options, we use // the react-scripts and babel-preset-react-app versions. cacheIdentifier: getCacheIdentifier( isEnvProduction ? 'production' : isEnvDevelopment && 'development', [ 'babel-plugin-named-asset-import', 'babel-preset-react-app', 'react-dev-utils', 'react-scripts', ] ), // @remove-on-eject-end plugins: [ isEnvDevelopment && shouldUseReactRefresh && require.resolve('react-refresh/babel'), ].filter(Boolean), // This is a feature ofbabel-loaderfor webpack (not Babel itself). // It enables caching results in ./node_modules/.cache/babel-loader/ // directory for faster rebuilds. cacheDirectory: true, // See #6846 for context on why cacheCompression is disabled cacheCompression: false, compact: isEnvProduction, }, }, ...............................

0

There are 0 best solutions below