首页 > 解决方案 > 如何使用 expo 运行 react-styleguidist “您可能需要适当的加载程序来处理此文件类型。”

问题描述

我想将 react-styleguidist 与 expo 一起用于 react-native 组件的 Web 开发。

到目前为止,我在运行时有以下内容npm run styleguide

./node_modules/react-native-safe-area-view/index.js 124:28
Module parse failed: Unexpected token (124:28)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| 
| class SafeView extends Component {
>   static setStatusBarHeight = height => {
|     _customStatusBarHeight = height;
|   };
 @ ./node_modules/@react-navigation/native/dist/index.js 25:11-49
 @ ./node_modules/react-navigation/src/react-navigation.js
 @ ./src/core/AppCore.js
 @ ./node_modules/react-styleguidist/lib/loaders/styleguide-loader.js!./node_modules/react-styleguidist/lib/client/index.js
 @ ./node_modules/react-styleguidist/lib/client/index.js
 @ multi ./styleguide/setup.js ./node_modules/react-styleguidist/lib/client/index ./node_modules/react-dev-utils/webpackHotDevClient.js

我使用 expo 并且从来不需要在 expo 项目中自己配置 webpack。为了在 expo 中运行 react styleguidist,我还需要在默认的 react-styleguidist webpack 配置中添加什么?

标签: reactjsreact-nativewebpackbabeljsexpo

解决方案


推荐阅读