If you would like to upgrade to a newer long-term support version of Studio Pro, see Upgrading from Mendix Studio Pro 9 to 10.
If you would like to upgrade to a newer long-term support version of Studio Pro, see Upgrading from Mendix Studio Pro 9 to 10.
Build a Pluggable Widget (Release Version)
Introduction
While you develop a pluggable widget, you will regularly use npm start or npm run build. These commands create a development build, which is meant for testing. Before you bundle your widget with a module or publish it to the Mendix Marketplace, you need to create a release build.
This document explains how a release build differs from a development build, how to create a release build, and how to find and test your results. This document applies to both web and native pluggable widgets.
Prerequisites
Before starting this how-to, make sure you have completed the following prerequisites:
- Have a pluggable widget created with the Pluggable Widget Generator. For more information, see Build a Pluggable Web Widget: Part 1 or Build a Pluggable Native Widget: Part 2.
Differences Between a Development Build and a Release Build
| Development build | Release build | |
|---|---|---|
| Source maps | Included | Not included |
| Code | Not minified | Minified and transpiled |
| Third-party dependency list | Not included | Included in the .mpk file as dependencies.txt and dependencies.json |
Creating a Release Build
To create a release build, run npm run release in the root directory of your widget. This command first checks your code for formatting and linting errors, and only creates the release build when no errors are found.
If errors are reported, fix them and run npm run release again.
Finding the Release Build
The release build creates an .mpk file in the dist folder of your widget, in a subfolder named after the version in package.json:
dist/{version}/{packagePath}.{widgetName}.mpkUse this .mpk file to publish your widget to the Marketplace or to include it in your module.
The release build also copies the .mpk file to the widgets folder of your Mendix app, the same way a development build does.
Testing the Release Build
To test the release build in your app, do the following:
- In Studio Pro, synchronize the app directory by pressing F4, or select App > Synchronize App Directory.
- Run your app and verify that the widget works as expected.