用cordova构建reactjs应用 [英] building reactjs app with cordova
本文介绍了用cordova构建reactjs应用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
只想测试一下,看看create-react-app的构建是否可以在Cordova上使用,并发现它出现在空白屏幕上。有人尝试过吗?
Just want to test and see if the build from create-react-app will work with Cordova, and found that it came up with the blank screen. Has anyone tried this?
$> create-react-app temp
$> cd temp
$> npm run build
$> cd ..
$> cordova create cordova-temp
将内容从temp>构建文件夹复制到cordova-temp> www
copy the content from temp > build folder into cordova-temp > www
$> cd cordova-temp
$> cordova run ios
这是产生此问题的方法。也许我想念一些东西。任何建议将不胜感激!谢谢!
this is how to produce this problem. Or perhaps I'm missing something. Any suggestion would be greatly appreciated! thank you!
推荐答案
您需要在 package.json <中将项目首页值设置为./。 / code>以便与CRA配合使用。
You need to set your project homepage value to ./ in package.json
for this to work with CRA.
例如:
首页: ./
这篇关于用cordova构建reactjs应用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文