React-starter-kit: How to get entire app in one .js file to include in a non-node server deployment

Created on 23 Jun 2015  Â·  6Comments  Â·  Source: kriasoft/react-starter-kit

Trying to figure out how I can get the entire app in a single .js file that I can then load in my non-node deployment. I am deploying in a Jetty Java container with a WAR file. I want to have my index.jsp (or index.html) in that WAR file load the entire app. I recall doing this before in my first attempt at ReactJS, and in my web app I have an API that I need my react app to make calls to for data to display. Is there an option to build the bundle.js that I can then just include in a separate page? If so, what else would my external page need to include (js, css, etc) in order to display the react app?

All 6 comments

If you bundle your assets with webpack, the output bundle.js can contain js, css and images.. reffer to webpack documentation, you wan want to look at url-loader, file-loader and similar plugins for webpack.

@justjacksonn This seed is isomorphic (see also hijax) using Node.js and Express. As it stands it allows users to disable JavaScript and continue using the app, while still benefiting from the use of Ajax and Virtual DOM while JS is enabled.

You might want to look at running the app inside a Docker container using forever or PM2, and then configuring Jetty to direct traffic to the server running within the container, using something like ANT to manage the Docker containers themselves during your deployment process assuming you're in an existing environment built around Java (otherwise look at Ansible). That's probably what I'd do anyways.

I believe this issue can be closed.

Actually.. to my surprise, the bundle.js does contain everything and my app works when deployed as a .war file. I just run the npm run build process, then the build process that pulls in index.html and bundle.js, war it up, and deploy it and it all works nicely. Thanks. Will close.

Very cool!
On Thu, Jul 9, 2015 at 4:52 PM justjacksonn [email protected]
wrote:

Actually.. to my surprise, the bundle.js does contain everything and my
app works when deployed as a .war file. I just run the npm run build
process, then the build process that pulls in index.html and bundle.js, war
it up, and deploy it and it all works nicely. Thanks. Will close.

—
Reply to this email directly or view it on GitHub
https://github.com/kriasoft/react-starter-kit/issues/149#issuecomment-120154621
.

@justjacksonn in your reply "Actually.. to my surprise, the bundle.js does contain everything and my app works when deployed as a .war file. I just run the npm run build process, then the build process that pulls in index.html and bundle.js, war it up, and deploy it and it all works nicely. Thanks. Will close.", how did you achieve " index.html and bundle.js, war it up". Thank You

how to deploy a react app on Apache web server?

Was this page helpful?
0 / 5 - 0 ratings