Unable to resolve module`./index.css` antd-mobile
运行 yarn ios
出现以下错误
Unable to resolve module `./index.css` from `node_modules/antd-mobile/lib/button/style/css.js`:
None of these files exist:
* node_modules/antd-mobile/lib/button/style/index.css(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
* node_modules/antd-mobile/lib/button/style/index.css/index(.native|.ios.js|.native.js|.js|.ios.json|.native.json|.json|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx)
RCTFatal
__28-[RCTCxxBridge handleError:]_block_invoke
_dispatch_call_block_and_release
_dispatch_client_callout
_dispatch_main_queue_callback_4CF
__CFRUNLOOP_IS_SERVICING_THE_MAIN_DISPATCH_QUEUE__
__CFRunLoopRun
CFRunLoopRunSpecific
GSEventRunModal
UIApplicationMain
main
start
App.js
import React from 'react';
import {Text, View} from 'react-native';
import {Button} from 'antd-mobile';
const App = () => {
return (
<View><Button><Text>CustomButton</Text></Button></View>
);
};
export default App;
babel.config.js
module.exports = {
presets: ['module:metro-react-native-babel-preset'],
plugins: [
["import", { "libraryName": "antd-mobile", "style": "css" }] // `style: true` for less
]
};
package.json
{
"name": "client",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios --simulator='iPhone 8'",
"start": "react-native start",
"test": "jest",
"lint": "eslint ."
},
"dependencies": {
"@ant-design/react-native": "^3.3.0",
"antd-mobile": "^2.3.1",
"babel-plugin-import": "^1.13.0",
"react": "16.11.0",
"react-native": "0.62.2"
},
"devDependencies": {
"@babel/core": "^7.6.2",
"@babel/runtime": "^7.6.2",
"@react-native-community/eslint-config": "^0.0.5",
"babel-jest": "^24.9.0",
"eslint": "^6.5.1",
"jest": "^24.9.0",
"metro-react-native-babel-preset": "^0.58.0",
"react-test-renderer": "16.11.0"
},
"jest": {
"preset": "react-native"
}
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论