You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/error-plugin.md
+21Lines changed: 21 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -98,3 +98,24 @@ When an error is thrown, the plugin does the following:
98
98
```
99
99
* [emit](/docs/event-emitter-plugin#emit) `ERROR` event with thrown error
100
100
* Re-runs the function (if defined)
101
+
102
+
The error object is available everywhere in the widget, as well as to the host application.
103
+
104
+
## Limitations
105
+
106
+
The plugin can't handle errors occurring outside of lifecycle functions.
107
+
108
+
## Custom errors
109
+
110
+
You can throw custom errors by instantiating `GenericError` class or create custom error classes that extend `GenericError`.
111
+
112
+
`GenericError` class carries `status` param among with other params. This way error plugin can respond with adequate HTTP status and also include data for encountered error.
Copy file name to clipboardExpand all lines: website/docs/integration-with-app.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -347,3 +347,30 @@ return (
347
347
</MerkurSlot>
348
348
)
349
349
```
350
+
351
+
## Merkur Dev Client
352
+
When integrating Merkur widgets into an existing application, developers often face challenges with the development workflow - particularly with hot module replacement (HMR). The Merkur Dev Client solves this problem by bringing the same seamless development experience you get in the playground directly to your integrated application.
353
+
### Bringing Playground Experience to Your Application
354
+
The Merkur Dev Client enables the same fluid development experience you enjoy in the playground environment when working with your widget in any integrated application:
355
+
- **Real-time Widget Updates**: Edit your widget code and see changes instantly in your application
356
+
- **No Application Refreshes**: Updates are applied without reloading the entire application
357
+
- **Preserve Application State**: Keep authentication, form inputs, and application context intact during development
358
+
### Enabling the Dev Client
359
+
To enable the Dev Client in your host application, simply add the following script tag to your HTML head:
1. Establishing a WebSocket connection to your Merkur dev server
372
+
2. Monitoring changes to Merkur widget assets (scripts, styles)
373
+
3. Automatically replacing or updating affected assets when changes are detected
374
+
4. Hooking into the Merkur widget creation process to track active widgets within your application
375
+
Assets are tracked using the `data-merkur-asset-name` attribute, which the Dev Client uses to identify and update them without reloading the entire application page.
376
+
The Dev Client is automatically configured when running your widget in development mode with the Merkur CLI (`merkur dev`), and only requires adding a single script tag to your host application.
Copy file name to clipboardExpand all lines: website/docs/merkur-cli.md
+1-1Lines changed: 1 addition & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ Merkur CLI for building your widget use [esbuild](https://esbuild.github.io/) to
10
10
11
11
## Commands
12
12
13
-
-`merkur dev` - build your widget with with NODE_ENV = 'development' and with watch mode
13
+
-`merkur dev` - build your widget with NODE_ENV = 'development' and with watch mode. Enables [Merkur Dev Client](/docs/integration-with-app#merkur-dev-client) for hot module replacement
14
14
-`merkur build` - build your widget with NODE_ENV = 'production'
15
15
-`merkur test` - run defined widget tests with NODE_ENV = 'test'
16
16
-`merkur start` - run widget server and playground server
0 commit comments