react踩坑笔记

1、create-react-app中配置webpack

// 方法一:将项目的配置文件抽取到项目中,即运行:
npm run eject

// 方法二:使用react-app-rewired

2、create-react-app中src文件夹的别名,当使用了ts时可以在tsconfig.json中配置

"compilerOptions": {
    "baseUrl":"src",
    "paths":{
      "src/*":["./*"],
      "components/*":["./components/*"],
      "pages/*":["./pages/*"],
      "api/*":["./api/*"],
      "routes/*":["./routes/*"],
      "reducers/*":["./reducers/*"],
      "store/*":["./store/*"]
    },
  },

猜你喜欢

转载自www.cnblogs.com/nightstarsky/p/12082369.html