在`react-native init`之后如何设置`react-native-web`

时间:2018-08-24 08:13:25

标签: react-native react-native-web

遵循react-rative-web上的指南后,我会遇到一些错误。

我首先创建了一个新项目:react-native init test --version 0.55.4

然后我安装了依赖项:

yarn add --dev babel-loader url-loader webpack webpack-cli webpack-dev-server babel-plugin-react-native-web
yarn add react react-dom react-native-web

复制了index.web.jsweb/webpack.config.js

执行命令后:

webpack-dev-server -d --config ./web/webpack.config.js --inline --hot --colors

我得到了错误:

ERROR in ./index.web.js
    Module build failed (from ./node_modules/babel-loader/lib/index.js):
    Error: Cannot find module 'react-art'

好。因此,我安装了(可选的)模块yarn add react-art

下一次运行打印:

ERROR in ./index.web.js
    Module build failed (from ./node_modules/babel-loader/lib/index.js):
    Error: Plugin 0 specified in "base" provided an invalid property of "createElement"

现在我不知道该怎么办。我该如何解决此错误(可能是以下错误)?

0 个答案:

没有答案