Repository navigation
[WTF-2749] Add docs on building a release version of a pluggable widget #12328
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
mlaponder
wants to merge
1
commit into
mendix:development
Choose a base branch
from
mlaponder:wtf/2749-pw-build-release-version
base: development
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+68
−0
Draft
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
65 changes: 65 additions & 0 deletions
65
...xtensibility/pluggable-widgets/build-a-release-version-of-a-pluggable-widget.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | | ||
| | --- | --- | --- | | ||
| | 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/) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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/) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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/) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Extra "|" here.