Going to production
Learn more about preparing your customizations for production usage.
When it's time to take your customization to production, you need to follow certain steps, such as building the production bundles and setting up the deployment.
Configuring the customization in the Merchant Center
Configure a new customization in the Merchant Center by following these guides:
This step is important to retrieve the customization identifier.
Assigning the customization identifier
Provide the identifier that was generated when you configured the customization in the Merchant Center.
- For Custom Applications: provide the Custom Application ID (
env.production.applicationId
) in the Custom Application config. - For Custom Views: provide the Custom View ID (
env.production.customViewId
) in the Custom View config.
Assigning the production URL
Provide the production URL (env.production.url
) in your Custom Application config or Custom View config.
Even if the URL hasn't been set up yet, you can still assign the value in the configuration.
Building production bundles
The production bundles are created by running the CLI build
command:
mc-scripts build
All the necessary static assets are created in the public
directory.
By default, the build
command compiles the index.html
, included in the public
folder. You can opt-out of the compilation step by using the option --build-only
. For more information, see the compile-html
command.
Deploying the production bundles
Deploying and hosting customizations is managed by you. This allows you to choose whatever hosting solution works best for you.
For more information, see our Deployment overview page.
Configuring rewrite rules
A customization is a Single-Page Application that uses client-side routing. Therefore, you need to instruct your hosting provider to rewrite all requests to serve the index.html
.
You can find examples in our Deployment overview page which explains how to do that for each hosting provider.
About Static Assets
Depending on where you want to host your customization you might choose to keep the static assets (JS, CSS, etc.) in the same location as the index.html
or to have them served by something like a CDN.
If you choose to have them hosted in a separate location, you need to configure the CDN URL (env.production.cdnUrl
) in your Custom Application config or Custom View config.
Finalizing the customization setup
Once the customization is hosted and the configuration is completed, you can move the customizations status to Ready. At this point, the customization is ready to be installed in the Merchant Center.
For more information, see Installing a Custom Application or Installing a Custom View in the Merchant Center documentation.