我需要使用index.php而不是index.html文件运行create-react-app,因为我有将发送给Javascript的逻辑php [英] I need run create-react-app with file index.php instead of index.html because I have logic php that I will send to Javascript

查看:85
本文介绍了我需要使用index.php而不是index.html文件运行create-react-app,因为我有将发送给Javascript的逻辑php的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

执行 npm运行弹出并将index.php重命名为index.html,但是它不起作用。我需要在index.php内包含一个类,以使用一个将数据加密转换为发送给React的函数。

Execute npm run eject and rename index.php to index.html, but it does not work. I need to include a class inside index.php to use a function that converts data encrypt to send toward React.

推荐答案

我发现一个解决方案,

首先,执行:

npm run eject

然后,将path.js中的代码更改为:

then, change the code in paths.js to:

appHtml: resolveApp('public/index.php')

和webpack.config.dev.js(同意| php):

and webpack.config.dev.js (agree |php):

exclude: [/\.(js|jsx|mjs|php)$/, /\.html$/, /\.json$/]

之后:

npm start

效果很好

这篇关于我需要使用index.php而不是index.html文件运行create-react-app,因为我有将发送给Javascript的逻辑php的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆