Closed xsjcTony closed 10 months ago
Can confirm, it's happening for us (on Deno Deploy) too.
I'm just scared... When a library that the whole page is built on will be suddenly broken during daytime... I might not use CDN for critical packages anymore😭
what happened?
i removed a line that adds ?target
param to the cache key that is used as the store key of KV/R2 in recent dumb refactor (https://github.com/esm-dev/esm.sh/commit/23050110e010ba29032e585adedd4622253873f2#diff-e9539f59664c8ae83b837c70056b40427c1041359a3102cb2650a9abb5dc5360L75), and today i deployed it accidentally
then the react(others have same issue) url is redirected to /stable/react@18.2.0/es2021/react.mjs
(latest cache in the storage), no matter what the user-agent
is. but react-dom still uses /stable/react@18.2.0/es2022/react.mjs
that impors multiple copy of react (different urls)
how it be fixed?
@xsjcTony @piscisaureus sorry for the breaking
Thank you for fixing it @ije !
Thanks. Any ETA on when will the fix be deployed?
already deployed, may need to clear the browser cache
Hello,
When we encountered this issue, we switched to the development version of React and it resolved the problem! Therefore, I'm contemplating whether adding a pin to the URL could safeguard our service from these types of issues in the future. Does this sound correct?
@wengtadashi you're suggested to use a pinned URL to avoid breaking changes
I understand that's how a pinned URL functions. However, I would like to know if a pinned URL would have prevented this specific issue at the time it occurred.
@ije Sorry, is this really deployed? If you open the playground above (the stackblitz link), it's still not working no matter what I do.
By visiting the esm.sh/react
straight away, it's still the old bugged version.
@xsjcTony Hi, did you try it with the browser cache disabled? If your browser caches the broken modules, the problem would still happen. I confirmed it worked after super reloading my browser.
@yykamei Yes I've disabled all caches, and even tried with other browsers like Edge, firefox, and in Incognito Mode as well. None of them works.
https://stackblitz.com/edit/vitejs-vite-qsenfs?file=src%2FApp.tsx
https://esm.sh/stable/react@18.2.0/es2022/react.mjs still includes var l={current:null}
I looked into your code on StackBlitz and found out you are using react-dom
from package.json
. After changing the line in main.tsx
like this, the code worked as expected. Maybe, it would be necessary to confirm you are importing react
and react-dom
from esm.sh.
- import ReactDOM from 'react-dom/client'
+ import ReactDOM from 'https://esm.sh/react-dom/client'
That's actually correct but why?... It doesn't make sense to me, since one should be able to import any packages by cdn and other packages bundled right? If that's the case, maybe all related packages either need to be all imported by CDN or all bundled?
I think it's a total valid use case, say I want to import react
via CDN, and bundle react-dom
myself right? and I don't see a reason it should break. Maybe I'm missing something but that's kinda weird.
🤔 I'm not sure that we can import react
and react-dom
from different sources.
Failing module
Reproduction: https://stackblitz.com/edit/vitejs-vite-qsenfs?file=src%2FApp.tsx
Error message
Additional info
Bug:
In the latest
https://esm.sh/react
, the content is:Then in
https://esm.sh/stable/react@18.2.0/es2021/react.mjs
, the content is:For
useState
, the corresponding code isHowever, the definition of
l
is:⚠️This error will happen to all other imports using
l.current
.Any idea what's happening? It's brining down all my sites using this.