dongmei2351 2019-06-25 15:52
浏览 128

如何在现有的非React页面中运行React组件?

I am working with a PHP app ( it's Joomla, but I don't think that matters much - I assume the answer here would be the same regardless of server-side technology ) and I want to embed a React app into one page of it.

I am building the React app outside my main application tree because I only want the output files in my web app. My approach is to use npm run build to build the React.js app and then copy the output of my /build folder into the /media/my-app folder of my site.

The output of my build process is a set of files that look like build/static/js/2.1a11a1a1.chunk.js, build/static/js/runtime-main.d5223cc00.js, build/static/js/main.0a010202.chunk.js and so on. These appear to be indexed by asset-manifest.json.

Having moved those files into /media/my-app what do I need to include in my PHP file for the app to work? Do I need to include React independently or is it part of the bundle? What do I need to include in order to be able to run the app from the manifest - I assume those hashed names are not something that we are supposed to be interacting with directly?

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 程序不包含适用于入口点的静态Main方法
    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记