New Jan 6, 2025

Inserting a react app into a DIV in a traditional LAMP based website

Libraries, Frameworks, etc. All from Newest questions tagged reactjs - Stack Overflow View Inserting a react app into a DIV in a traditional LAMP based website on stackoverflow.com

Using vite, I did a npm run build for my mini react app.

It created a dist folder containing index.html page with the assets folder.

But I want the <div id="root"></div> from my index.html to be inserted into an already built website (custom traditional LAMP based without a framework) which will sit in one DIV at one corner or side of the webpage.

  1. So how do I insert this specifically ... because the JS and CSS filenames keep changing on every build.
<script type="module" crossorigin src="/assets/index-lmRs6HEq.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-n_ryQ3BS.css">
<div id="root"></div>
  1. How do I insert this in my LAMP site when in development (npm run dev) ?

I am looking for a clean build process without the need to support older methodologies since this is a new React (18/19) app.

  1. I am open to the same process for Vue3.
Scroll to top