Skip to content

Commit

Permalink
chore(doc): hot reload imported files (#417)
Browse files Browse the repository at this point in the history
* [doc] Hot reload imported files

[doc] Hot reload imported files
Issue #267

* Update importer-guidelines.md

PR suggestions.
  • Loading branch information
atopper authored Aug 20, 2024
1 parent 40a2636 commit b7b0029
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions importer-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -738,3 +738,16 @@ export default {
```

Just add the extra styles you need to perform your transformation.

### Hot reload of JS Dependencies

It is common to use multiple files for the import process, usually using `import.js` as the entry. By default, the UI will only hot reload changes in the "Transformation file URL" specified in the UI (i.e. import.js) and *not* its 'imports' which forces the user to refresh whenever dependencies are changed. To enable hot reload of dependencies, `esbuild` can be used with the watch option.

- Ensure `esbuild` is installed and accessible.
- From the command line, start `esbuild` as follows (varying paths and/or parameters as required):
- `esbuild import.js --bundle --outdir=importjs --watch`
- This will watch for changes on import.js **and** all its imports, bundling them in the specified `outdir`.
- In the Importer UI, change the transformation file indicated to the one that is built in the output dir.

Now the UI will load the bundled JS file, which will be automatically built when any changes are made.

0 comments on commit b7b0029

Please sign in to comment.