current position:Home>React configuration component path reference @ to represent SRC root path

React configuration component path reference @ to represent SRC root path

2022-06-24 07:52:58Zhangxiaolang

create-react-app Project created , Out of sight webpack Related configuration files , It needs to be exposed first , Use the following command

npm run eject

 

stay config Modify the configuration file

  • webpack.config.js
   resolve: {
      ...
      alias: {
        ...
        //  Path reference  @
        '@': paths.appSrc,
      }
    }

Restart project  

copyright notice
author[Zhangxiaolang],Please bring the original link to reprint, thank you.
https://en.qdmana.com/2022/175/202206240328341042.html

Random recommended