Compiling a Custom Application
One of the necessary steps to prepare your Custom Application for a deployment is to create a production build. If you decide to host your Custom Application statically and do not intend to use the provided HTTP server, you need to compile your Custom Application.
This section helps prepare your Custom Application for static hosting by going through the compilation step.
Why compile?
When creating a production build, mc-scripts build
takes your Custom Application code and generates assets that can be served statically.
One of these assets is a file named index.html.template
. This file contains references to bundles (your code and other assets) and placeholders that needs to be replaced with values specific to your Custom Application configuration.
Therefore, compiling the application simply results in having a final index.html
with all the correct runtime values in place.
Once your Custom Application is compiled, it is ready for deployment.
Prerequisites
Before you get started, you need to do the following:
- Configure your Custom Application.
- Create a production build of your Custom Application.
Compiling your Custom Application
Run the following command to compile your Custom Application:
mc-scripts compile-html --use-local-assets
The command above does what we need: it compiles a index.html
using the references to the JavaScript bundle (created by running mc-scripts build
). It also replaces the placeholders with the needed values based on the Custom Application configuration file. At this point the index.html
file is ready for production usage.
Deployment
We provide some step-by-step tutorial examples for hosting a Custom Application statically to popular hosting providers: