当我运行这个命令时:
expo build:android
我收到以下错误:
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.expo.ts|.na
tive.expo.ts|.expo.ts|.ios.expo.tsx|.native.expo.tsx|.expo.tsx|.ios.expo.js|.nat
ive.expo.js|.expo.js|.ios.expo.jsx|.native.expo.jsx|.expo.jsx|.ios.ts|.native.ts
|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|
.ios.json|.native.json|.json|.ios.wasm|.native.wasm|.wasm)
* node_modules\antd-mobile\lib\button\style\index.css\index(.native|.ios.expo.
ts|.native.expo.ts|.expo.ts|.ios.expo.tsx|.native.expo.tsx|.expo.tsx|.ios.expo.j
s|.native.expo.js|.expo.js|.ios.expo.jsx|.native.expo.jsx|.expo.jsx|.ios.ts|.nat
ive.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx
|.jsx|.ios.json|.native.json|.json|.ios.wasm|.native.wasm|.wasm)
Packager URL http://127.0.0.1:19001/node_modules\expo\AppEntry.bundle?dev=false&
minify=true&hot=false&platform=ios returned unexpected code 500. Please open you
r project in the Expo app and see if there are any errors. Also scroll up and ma
ke sure there were no errors or warnings when opening your project.
我已经完成了以下工作:
npm cache verify
expo -r c
package.json
文件如下所示:
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"@babel/runtime": "^7.7.7",
"antd-mobile": "^2.3.1",
"babel-plugin-import": "^1.13.0",
"expo": "~36.0.0",
"rc-form": "^2.4.11",
"react": "~16.9.0",
"react-dom": "~16.9.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-36.0.0.tar.gz",
"react-native-gesture-handler": "~1.5.0",
"react-native-maps": "0.26.1",
"react-native-reanimated": "~1.4.0",
"react-native-safe-area-context": "0.6.0",
"react-native-web": "~0.11.7",
"react-navigation": "^4.0.10",
"react-navigation-stack": "^2.0.12",
"react-navigation-tabs": "^2.7.0",
"react-redux": "^7.1.3",
"redux": "^4.0.5",
"redux-logger": "^3.0.6",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"babel-preset-expo": "~8.0.0",
"@babel/core": "^7.0.0"
},
"private": true
}
babel.config.js
如下所示:
module.exports = function(api) {
api.cache(true);
return {
presets: ['babel-preset-expo'],
plugins: [
[
"import",{ libraryName: "antd-mobile", style: "css" }
]
]
};
};