how to add bundled react component into php page

Viewed 76

I'm new to react and I'm having a PHP developed website to which I want to add a react component, I tried to load certain components using Universal Module Definition (UMD) files in tags but this method was causing performance issues so I decided to use a bundler like webpack to bundle my code and modules into a single script. these are the script tags added to my PHP page including the path to the bundle.min.js file created with webpack.

<script src="https://unpkg.com/react@16/umd/react.production.min.js"  crossorigin ></script>
<script src="https://unpkg.com/react-dom@16/umd/react-dom.production.min.js" crossorigin ></script>
<script src="https://unpkg.com/@babel/standalone/babel.min.js"></script> 
<script type="text/javascript" src="/react-component/bundle.min.js"></script>

Those scripts aren't making any changes in the PHP page and I'm getting in the console :

react-component/bundle.min.js net::ERR_ABORTED 404 (Not Found)

Is this related to static files inclusion into PHP?

0 Answers
Related