Skip to content

Commit a7b7be5

Browse files
authored
Merge pull request #56 from pyscript/fix-js_modules-json
Fix mistakes in js_modules related docs. Mention this is Pyodide only.
2 parents 11180fd + db3145a commit a7b7be5

File tree

1 file changed

+19
-5
lines changed

1 file changed

+19
-5
lines changed

docs/user-guide/configuration.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,11 @@ plugins = ["custom_plugin", "!error"]
314314

315315
It's easy to import and use JavaScript modules in your Python code.
316316

317+
!!! warning
318+
319+
This feature currently only works with Pyodide. MicroPython support will
320+
come in a future release.
321+
317322
To do so, requires telling PyScript about the JavaScript modules you want to
318323
use. This is the purpose of the `js_modules` related configuration fields.
319324

@@ -347,9 +352,11 @@ module for creating interactive maps you'd add the following lines:
347352

348353
```JSON title="JavaScript main thread modules defined in JSON"
349354
{
350-
"js_modules.main": {
351-
"https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet-src.esm.js": "leaflet",
352-
"https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css": "leaflet"
355+
"js_modules": {
356+
"main": {
357+
"https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet-src.esm.js": "leaflet",
358+
"https://cdn.jsdelivr.net/npm/[email protected]/dist/leaflet.css": "leaflet"
359+
}
353360
}
354361
}
355362
```
@@ -385,10 +392,17 @@ Some JavaScript modules (such as
385392
access to the DOM and, for efficiency reasons, can be included in the worker
386393
context:
387394

395+
```TOML title="A JavaScript worker module defined in TOML"
396+
[js_modules.worker]
397+
"https://cdn.jsdelivr.net/npm/html-escaper" = "html_escaper"
398+
```
399+
388400
```JSON title="A JavaScript worker module defined in JSON"
389401
{
390-
"js_modules.worker": {
391-
"https://cdn.jsdelivr.net/npm/html-escaper": "html_escaper"
402+
"js_modules": {
403+
"worker": {
404+
"https://cdn.jsdelivr.net/npm/html-escaper": "html_escaper"
405+
}
392406
}
393407
}
394408
```

0 commit comments

Comments
 (0)