Skip to content

Commit

Permalink
Merge pull request FlowFuse#834 from bartbutenaers/skip-modification
Browse files Browse the repository at this point in the history
Generate source map during development
  • Loading branch information
joepavitt authored May 9, 2024
2 parents 1f0208e + 3a9c679 commit 5d3875f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 9 deletions.
22 changes: 13 additions & 9 deletions docs/contributing/widgets/third-party.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,19 @@ To start working with your own third-party widget, locally on your machine:

1. Install Node-RED
2. Install `@flowfuse/node-red-dashboard` into Node-RED via the "Manage Palette" option.
2. Fork our [Example Node repository](https://github.com/FlowFuse/node-red-dashboard-example-node) and clone it locally to your machine.
3. Navigate to your local Node-RED directory and install the local copy of the Example Node:
```bash
npm install /path/to/your/local/node-red-dashboard-example-node
```
4. Inside the Example Node directory, build the Example Node's `.umd.js` file, this will generate it's `/resources` folder, loaded by Node-RED.
```bash
npm run build
```
3. Fork our [Example Node repository](https://github.com/FlowFuse/node-red-dashboard-example-node) and clone it locally to your machine.
4. Navigate to your local Node-RED directory and install the local copy of the Example Node:
```bash
npm install /path/to/your/local/node-red-dashboard-example-node
```
5. Optionally generate a source map (to map the minified code to the original code), to simplify debugging of the frontend code in the browser. On Linux this can be achieved by:
```bash
export NODE_ENV=development
```
6. Inside the Example Node directory, build the Example Node's `.umd.js` file, this will generate it's `/resources` folder, loaded by Node-RED.
```bash
npm run build
```

_Note: Any local changes you make inside the `/ui` folder of the third party widget, you'll need to re-run `npm run build` in order to update the `umd.js` file, which is what Dashboard loads to render the widget._

Expand Down
2 changes: 2 additions & 0 deletions vite.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export default defineConfig({
],
root: 'ui',
build: {
// Generate a source map in dev mode
sourcemap: process.env.NODE_ENV === 'development',
outDir: '../dist',
emptyOutDir: true
},
Expand Down

0 comments on commit 5d3875f

Please sign in to comment.