create-react-app为啥没有webpack配置文件,想要修改怎么办。
见官方文档
默认配置文件都是隐藏的,如果要自定义,运行npm run eject
Converting to a Custom Setup
If you’re a power user and you aren’t happy with the default
configuration, you can “eject” from the tool and use it as a
boilerplate generator.Running npm run eject copies all the configuration files and the
transitive dependencies (Webpack, Babel, ESLint, etc) right into your
project so you have full control over them. Commands like npm start
and npm run build will still work, but they will point to the copied
scripts so you can tweak them. At this point, you’re on your own.Note: this is a one-way operation. Once you eject, you can’t go back!
You don’t have to ever use eject. The curated feature set is suitable
for small and middle deployments, and you shouldn’t feel obligated to
use this feature. However we understand that this tool wouldn’t be
useful if you couldn’t customize it when you are ready for it.
点开package.json文件,可看到配置的命令是以 "react-scripts *" 来执行,所以打开node_modules文件夹,找到react-scripts文件夹进去, config目录即是你需要找的webpack的配置文件,然后就自己去修改配置就好
10 回答11.1k 阅读
6 回答3k 阅读
5 回答4.8k 阅读✓ 已解决
4 回答3.1k 阅读✓ 已解决
2 回答2.7k 阅读✓ 已解决
3 回答1.9k 阅读✓ 已解决
3 回答2.3k 阅读✓ 已解决
npm run eject