antd - Win7下使用react-app-rewired提示babel-loader no found

查看:587
本文介绍了antd - Win7下使用react-app-rewired提示babel-loader no found的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

按照新版官网在 create-react-app 中使用 的文档,使用react-app-rewired。
start时闪过babel-loader no found的提示,CSS不能正常加载。
如果重新install babel-loader或者babel-runtime会removed一些文件,然后提示react-app-rewired不存在。
环境:
Win7 + node.js 6.11.0 + npm 5.3.0
create-react-app 1.4.0
"antd": "^2.11.0"
"babel-loader": "7.0.0",
"babel-plugin-import": "^1.2.1",
"react-app-rewired": "^1.2.2"

使用原先的eject方法没有问题


按照大熊的方法改了确实可行。谢谢
但是每次yarn add后都要找到这个文件,删除/一次
还有一些某明奇妙的错误。
所以我还是老老实实的eject吧

解决方案

作者源代码有问题,需要修改源码,把 node_modules/react-app-rewire/index.js 中rule.loader.indexOf("babel-loader/") != -1;的'/'删掉

GitHub issue

这篇关于antd - Win7下使用react-app-rewired提示babel-loader no found的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆