reactjs-Electron Forge+NativeBase=网页包加载程序问题
发布时间:2022-04-12 16:30:31 437
相关标签: # node.js
我想在Electron Forge应用程序中使用NativeBase,但在渲染过程中收到网页错误:
webpack 5.72.0 compiled with 3 errors in 6349 ms
✖ Compiling Renderer Code
Electron Forge was terminated:
ModuleNotFoundError: Module not found: Error: Can't resolve 'react-native/Libraries/Utilities/codegenNativeComponent' in '/omitted/node_modules/react-native-safe-area-context/lib/module/specs',
ModuleNotFoundError: Module not found: Error: Can't resolve 'react-native/Libraries/Utilities/codegenNativeComponent' in '/omitted/node_modules/react-native-safe-area-context/lib/module/specs',ModuleNotFoundError:
Module not found: Error: Can't resolve 'react-native/Libraries/Image/resolveAssetSource' in '/omitted/node_modules/react-native-svg/lib/module'
我想我需要修改我的网页渲染器配置,但不确定如何继续,因为我们现在有react native web和react native混合。有人能提供建议吗?
迄今采取的步骤:
- 生成了一个全新的ElectronForge应用程序(
npx create-electron-app my-new-app --template=typescript-webpack
) - 修改
index.html
加上
身体 - 安装React、React dom依赖项和修改应用程序。tsx
import { FC } from 'react;
import { render } from "react-dom";
const Application: FC = () => (
<div>
<h1>My React App</h1>
</div>
)
render(<Application />, document.getElementById("root"));
- 继续安装NativeBase(遵循CRA说明)
yarn add react-native-web native-base react-native-svg react-native-safe-area-context
- 将NativeBaseProvider添加到应用程序组件
import { FC } from 'react;
import { render } from "react-dom";
import { NativeBaseProvider, Box } from "native-base";
const Application: FC = () => (
<NativeBaseProvider>
<Box>
<h1>My React App</h1>
</Box>
</NativeBaseProvider>
)
render(<Application />, document.getElementById("root"));
- 启动电子锻造并遇到错误
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报