Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions content/en/docs/howto/extensibility/build-native-widget.md
Original file line number Diff line number Diff line change
Expand Up @@ -1371,3 +1371,4 @@ The developer needs to have the class names memorized to apply a certain group b
* [Designing Mobile User Interfaces](/refguide/mobile/designing-mobile-user-interfaces/)
* [Native Mobile Styling Reference Guide](/refguide/native-styling-refguide/)
* [How to Build Pluggable Widgets](/howto/extensibility/pluggable-widgets/)
* [Build a Release Version of a Pluggable Widget](/howto/extensibility/build-a-release-version-of-a-pluggable-widget/)
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
---
title: "Build a Release Version of a Pluggable Widget"
linktitle: "3. Release Pluggable Widget"
url: /howto/extensibility/build-a-release-version-of-a-pluggable-widget/
weight: 30
description: "Describes how to create a release build of a pluggable widget that you can bundle with a module or publish to the Marketplace."
---

## Introduction

While you develop a pluggable widget, you 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.

{{% alert color="warning" %}}
Do not distribute a development build. It includes source maps and unminified code, which makes the widget much larger and slower to load. Always use a release build for modules and Marketplace content.
{{% /alert %}}

This how-to explains how a release build differs from a development build, how to create one, and how to find and test the result. It applies to both web and native pluggable widgets.

## Prerequisites

A pluggable widget created with the Pluggable Widget Generator. For more information, see [Build a Pluggable Web Widget: Part 1](/howto/extensibility/create-a-pluggable-widget-one/) or [Build a Pluggable Native Widget](/howto/extensibility/build-native-widget/).

## Differences Between a Development Build and a Release Build

| | Development build | Release build |

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra "|" here.

| --- | --- | --- |
| 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 linting errors, and only creates the release build when no errors are found.

If linting 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**:

```text
dist/{version}/{packagePath}.{widgetName}.mpk
```

Use 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.

{{% alert color="info" %}}
Copying the release build to your app requires Pluggable Widgets Tools 11.16.1 or above. With an earlier version, copy the *.mpk* file to the **widgets** folder of your app manually. For more information on updating, see [Update Pluggable Widgets Tools](/howto/extensibility/update-pluggable-widgets-tools/).
{{% /alert %}}

## Testing the Release Build

To test the release build in your app, do the following:

1. In Studio Pro, synchronize the project directory by pressing <kbd>F4</kbd>, or select **App** > **Synchronize Project Directory**.
1. Run your app and verify that the widget works as expected.

## Read More

* [Build a Pluggable Web Widget: Part 1](/howto/extensibility/create-a-pluggable-widget-one/)
* [Build a Pluggable Native Widget](/howto/extensibility/build-native-widget/)
* [Update Pluggable Widgets Tools](/howto/extensibility/update-pluggable-widgets-tools/)
* [Pluggable Widgets API](/apidocs-mxsdk/apidocs/pluggable-widgets/)
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,7 @@ Continue with the next tutorial to learn how to add validation feedback, custom
## Read More

* [Build a Pluggable Web Widget: Part 2 (Advanced)](/howto/extensibility/create-a-pluggable-widget-two/)
* [Build a Release Version of a Pluggable Widget](/howto/extensibility/build-a-release-version-of-a-pluggable-widget/)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll change the title to "Build a Pluggable Web Widget: Part 3 (Release Version)" just to keep the title consistent with the form of the first 2.

* [Pluggable Widgets API](/apidocs-mxsdk/apidocs/pluggable-widgets/)
* [Client APIs Available to Pluggable Widgets](/apidocs-mxsdk/apidocs/pluggable-widgets-client-apis/)
* [Pluggable Widget Property Types](/apidocs-mxsdk/apidocs/pluggable-widgets-property-types/)
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ Follow these guidelines when developing widgets and submitting them to the Marke
* A function should only do one thing, and do it properly.
* Use hooks and functional components over class components.
* Create test pages for mobile when content is made for mobile platforms.
* Submit a release build of the widget. For more information, see [Build a Release Version of a Pluggable Widget](/howto/extensibility/build-a-release-version-of-a-pluggable-widget/).