Commit 009a732
fix: isDayjs import usage for ESM (#2924)
### 🎯 Goal
_Describe why we are making this change_
recently we moved our stack to ESM (micro frontends, uses import maps).
Noticed we are getting below error in the micro-frontend that uses
`stream-chat-react`,
```
Failed to load module mfe-chat SyntaxError: The requested module 'dayjs' does not provide an export named 'isDayjs' (at index.umd-ce148d01.js:18:14)
```
on further investigation, found:
- `isDayjs` is actually not exported in `dayjs` esm build. It needs to
be accessed to through `dayjs` instance.
- We are using importmap (esm), to satisfy `dayjs` dependency, this
fails because of improper import of `isDayjs`
simply create `index.html`, with below code and run it
**this will fail,**
```html
<script type="module">
import { isDayjs } from "https://cdn.jsdelivr.net/npm/dayjs@1.10.4/+esm";
console.log(isDayjs);
</script>
```
**this will pass,**
```html
<script type="module">
import Dayjs from "https://cdn.jsdelivr.net/npm/dayjs@1.10.4/+esm";
console.log(Dayjs.isDayjs);
</script>
```
related ticket in dayjs, iamkun/dayjs#1306
### 🛠 Implementation details
_Provide a description of the implementation_
- fix import usage
### 🎨 UI Changes
_Add relevant screenshots_
Co-authored-by: Anton Arnautov <43254280+arnautov-anton@users.noreply.github.com>1 parent 706978b commit 009a732
1 file changed
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| |||
100 | 100 | | |
101 | 101 | | |
102 | 102 | | |
103 | | - | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
104 | 106 | | |
105 | 107 | | |
106 | 108 | | |
| |||
0 commit comments