About create-react-app webapck profile Modification

after successful installation, there is a file with the file name config-overrides.js,

/ * *
* @ do stuff with the webpack config.
* /
module.exports = function override (config, env) {

//
   config = injectBabelPlugin(
     [
         "import", 
         { 
             libraryName: "antd", 
             libraryDirectory: "es", 
             style: "css" 
         }
     ],
     config,
);


return config;

};

how can I add or modify configuration information here? Try to modify it, but the final result is unsuccessful.


to modify the webpack configuration of create-react-app, you need to first

    npm run eject

decompile, and then you can see the original configuration file.


can not be said to be full of holes, the starting point is different, the purpose of scaffolding itself is to provide a general-purpose build solution. As far as I understand it, the starting point of using create-react-rewired is to cater to the development habits of developers or teams, such as customizing the configuration of babel, eslint or css preprocessors, and generally providing configuration item parameters. For custom webpack itself, it is better to eject and change it slowly.

Menu