DEV Community

Discussion on: Setup React with Webpack and Babel

Collapse
 
sfarkas1988 profile image
Sandor Farkas

Thank you @daniel !
This week I was unsure how to solve the following issue:

I've an existing legacy application in PHP and plain HTML, css and JS served by apache.
Now I wanted to add react into the project. I usually use create-react-app to start a separate react app. But I want to use React inside the apache based application therefor I'm unsure how to set up React to run inside the legacy app.
I was able to build the react code with babel and run a simple hello world react app, but I'm not sure how to setup babel and webpack to be used in dev mode without the webpack dev server because the code should run on the existing apache based code. Any suggestion? Maybe worth a new blog post?
Thank you in advance
Best
Sandor

Collapse
 
dtroyano86 profile image
Daniel Troyano

Ya for sure swapping over to production mode in general would probably be worthy of another post. I'll try to think on it.

But for your current problem, I would say check out Webpack's production documentation. I'm still learning, but my understanding would be that once you get the code working the way you want with the development build, you should be able to swap the mode over to 'production' and generate a minified version that you can just add to your html file.

Best of luck with that!
Daniel