Plug webpack-dev-server and hot-load React with Tomcat - reactjs

I'm developing inside ecosystem that uses Tomcat server that servers all the files both java and javascript but the I run the javascript first through WebPack.
Is there any way that I can use webpack-dev-server and hot-loader for react/css/javascript files with running Tomcat server on localhost:8080 ?

Related

Do you need a web server to run a production build of a react app on a VPS?

I have built a react app using a truffle box that uses create-react app. I can get the app running on my local host but I can't see it on my VPS when I go to the IP address of my VPS and I run exactly the same commands and I get the same output in the terminal. I go in to my client dir and run npm start. I have tried to make a build and run the build through an http server in the client dir and the root folder of the VPS.
I run
serve -s build
All I can see is the index of the build in the browser when I try and serve the build through a webserver. When I run npm start on my localhost I can view my app but it doesn't work on my VPS. Please help me I've been struggling with this for days and its the last part of my project.
You need a webserver in any case.
When you do a local development, you do use webpack dev server (which is inside of create react app).
For the production, you need to make a production build and serve it for example by nginx. Here some details how to create production build with CRA https://create-react-app.dev/docs/production-build
On your screenshot, you don't see your site, because there is no entry point in your folder. By default it should be index.html

Deploying ReactJs app in my machine through localhost

I create a reactJs App. But for now I run this app through Intellij idea and I would like to deploy it and run permanently in my machine without turning on through Intellij idea. How I could deploy react app and run it as deployment in my machine
If you created your app with create-react-app, you should be able to start local development server from the command line. To do this, open you project's root directory in the terminal and type npm start.
If you would like to create and serve a production bundle, you should build your project with npm run build and then serve build directory with a web server. The easiest way to do this is install serve via npm (npm install -g serve) and run serve -s build
For this purpose only webservers available like Tomcat, Payara, Whildfly, etc. You can install any one of those servers and deploy your application into that. As on when you started the server your application will be accessible.
Approach 1:
You can set up the server into your IDE and simply run the project on server mode.
Approach 2:
By using your project code, create a war file with the help of any build tool like MAVEN/GRADLE, etc. Then login into the server manager(Tomcat Manager) and deploy the generated .war file in deployment section.
Note: With the 2nd approach, you can access the application as on when you start the server.

Hosting Angularjs 1.x application in tomcat server

How to host angular1 application tomcat server . I have developed one website in angularjs 1.x and want to host that on VPS server purchased from godaddy .
If your angularjs build is working properly you should have something like a "dist" folder with your complete app inside.
Enter that directory and create your .war file with:
$ jar -cvf theNameOfYourApp.war *
This will create a .war file that you can deploy on your tomcat server.

how to deploy a react app bundled with webpack on EC2

I have built an Application using react and I want to deploy it on my EC2 instance. I have bundled it using webpack and I was using webpack-dev-server for development purposes. The bundler has produced an output with public directory and index.js as the output of my code. I have included this index.js in my index.html and now I want to deploy it on my EC2 instance. Is there any specific http server which I can use to deploy this app. I am new to web application development so any suggestions will be appreciated.

React app using webpack to be deployed on JBOSS

Any idea how to deploy a React app or angular app to JBOSS webserver ?
I was working on a POC project using React and webpack-dev-server and now I have a bundle.js. Is it possible to deploy the bundle.js under a JBOSS directory (webapp.war)
Or will I need somehow run my react application on a separate server and port using npm/node/express and then somehow redirect JBOSS requests to this url ?
Please help.

Resources