I need run create-react-app with file index.php in

2019-09-30 08:07发布

问题:

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.

回答1:

I found a solution,

First, execute:

npm run eject

then, change the code in paths.js to:

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

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

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

after:

npm start

this works well