BETA

Production Build

After authoring your Custom Application, you eventually want to deploy your application to a staging environment for testing purposes or to a production environment. One of the key steps to prepare your Custom Application for a deployment is creating a production build of your Custom Application.

This section helps prepare your Custom Application for deployment by creating a production build.

Prerequisites

Before you get started, you need to do the following:

  • Configure your Custom Application.

Build

To run the application in production mode, we need to build it using the following command:

mc-scripts build

Production build

The mc-scripts build command creates a dist/ directory containing all the generated JavaScript and CSS static assets. Most of the files are artifacts of the <ApplicationShell> due to Code-Splitting.

The command also generates a file named index.html.template. This file is generated by Webpack and contains references to the bundles, for example:

<!DOCTYPE html>
<html lang="en">
<head>
<link href="__CDN_URL__17.app.988cd155551de3c7e71c.css" rel='stylesheet' type='text/css' /></link>
<!-- other elements -->
</head>
<body>
<div id="app"></div>
<!-- other elements -->
<script src="__CDN_URL__runtime~app.47483a5f2f8fed96e937.js"></script>
</body>
</html>

The file index.html.template is very important and needs to be compiled into the index.html so that the Custom Application can be served on production.

Sign upLog inTech BlogIntegrationsStatusSupportUser Research Program
Copyright © 2021 commercetools
Privacy PolicyImprint