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: README.md
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -29,13 +29,8 @@ While it is ideal, the luxury of having full control over the application is not
29
29
</script>
30
30
```
31
31
32
-
## Solutions
33
-
34
32
### `dynamic-importmap` solution
35
33
36
-
Note that `dynamic-importmap` is meant to be a last resort (e.g., after considering the alternatives listed below).
37
-
As noted by the WICG (quoted above), import maps should ideally be defined at the application level using `<script type="importmap"/>` to ensure that common modules can be shared.
@@ -54,6 +49,11 @@ As noted by the WICG (quoted above), import maps should ideally be defined at th
54
49
</script>
55
50
```
56
51
52
+
Note that `dynamic-importmap` is meant to be a last resort (e.g., after considering the alternative solutions below).
53
+
As noted by the WICG (quoted above), import maps should ideally be defined at the application level using `<script type="importmap"/>` to ensure that common modules can be shared.
54
+
55
+
## Alternative solutions
56
+
57
57
### ESM-aware CDN solution
58
58
59
59
An alternate solution is to use a CDN such as [esm.sh](https://esm.sh/) which can perform bare import specifier rewriting on the server side.
@@ -122,7 +122,7 @@ Just kidding :laughing:
122
122
123
123
A common practice is to publish a React component library to NPM as ESM in which `react` and `react-dom` have been "externalized" and kept as bare import specifiers.
124
124
Using `dynamic-importmap`, this component library can be dynamically imported from a regular CDN (e.g., [unpkg](https://unpkg.com/)), without having full control over the importmaps on the page.
125
-
For example, such a React component library might need to be imported into an ES module that will run in a Jupyter notebook with [anywidget](https://github.com/manzt/anywidget).
125
+
For example, such a React component library might need to be imported into an ES module that will run in a Jupyter notebook with [anywidget](https://github.com/manzt/anywidget) or an R [htmlwidget](https://www.htmlwidgets.org/develop_intro.html#javascript-binding).
0 commit comments