-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix!: do not use a custom resolve function that auto imports from esm.sh
Although initially this worked well, we do not know if we want to load from a module, or from esm.sh. Instead, we can have the default import map make MUI and confetti-canvas work.
- Loading branch information
1 parent
90ce5a9
commit a277d3d
Showing
4 changed files
with
42 additions
and
41 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -223,14 +223,15 @@ Apart from `react`, the default we provide is: | |
|
||
```python | ||
define_import_map({ | ||
"@mui/material": "https://esm.sh/@mui/[email protected]", | ||
"@mui/material/": "https://esm.sh/@mui/[email protected]/", | ||
"@mui/icons-material/": "https://esm.sh/@mui/icons-material/", | ||
"canvas-confetti": "https://esm.sh/[email protected]", | ||
"@mui/material": "https://esm.sh/@mui/[email protected]?external=react,react-dom", | ||
"@mui/material/": "https://esm.sh/@mui/[email protected]&external=react,react-dom/", | ||
"@mui/icons-material/": "https://esm.sh/@mui/icons-material/?external=react,react-dom", | ||
"canvas-confetti": "https://esm.sh/[email protected]?external=react,react-dom", | ||
}) | ||
|
||
``` | ||
|
||
_Note that it is important to add `external=react,react-dom`, otherwise [esm.sh](https://esm.sh/#using-import-maps) would import ReactJS again_. | ||
|
||
Which means we can now write our ConfettiButton as: | ||
|
||
```python | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -773,10 +773,10 @@ | |
"\n", | ||
"```python\n", | ||
"define_import_map({\n", | ||
" \"@mui/material\": \"https://esm.sh/@mui/[email protected]\",\n", | ||
" \"@mui/material/\": \"https://esm.sh/@mui/[email protected]/\",\n", | ||
" \"@mui/icons-material/\": \"https://esm.sh/@mui/icons-material/\",\n", | ||
" \"canvas-confetti\": \"https://esm.sh/[email protected]\",\n", | ||
" \"@mui/material\": \"https://esm.sh/@mui/[email protected]?external=react,react-dom\",\n", | ||
" \"@mui/material/\": \"https://esm.sh/@mui/[email protected]&external=react,react-dom/\",\n", | ||
" \"@mui/icons-material/\": \"https://esm.sh/@mui/icons-material/?external=react,react-dom\",\n", | ||
" \"canvas-confetti\": \"https://esm.sh/[email protected]?external=react,react-dom\",\n", | ||
"})\n", | ||
"\n", | ||
"```\n", | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,9 +69,9 @@ def _update_import_map(): | |
# still for backwards compatibility | ||
define_import_map( | ||
{ | ||
"@mui/material": "https://esm.sh/@mui/[email protected]", | ||
"@mui/material/": "https://esm.sh/@mui/[email protected]/", | ||
"@mui/icons-material/": "https://esm.sh/@mui/icons-material/", | ||
"canvas-confetti": "https://esm.sh/[email protected]", | ||
"@mui/material": "https://esm.sh/@mui/[email protected]?external=react,react-dom", | ||
"@mui/material/": "https://esm.sh/@mui/[email protected]&external=react,react-dom/", | ||
"@mui/icons-material/": "https://esm.sh/@mui/icons-material/?external=react,react-dom", | ||
"canvas-confetti": "https://esm.sh/[email protected]?external=react,react-dom", | ||
} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters