breaks in projects with cjs/esm scripts combintaion #1046
Unanswered
megastels
asked this question in
Bug report
Replies: 1 comment
-
This is a known issue as dual package hazard, and we decided to not solve it on the library end. You need to create a wrapper on your end so that only ESM or CJS of valtio will be used. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Bug Description
Reproduction
https://stackblitz.com/edit/stackblitz-starters-vnprfupv?file=index.mjs
Why this happens
rollup split code to cjs/esm at build time and every bundle have unique internal state.
when
proxy
called in cjs file, valtio register state inside cjs bundle, but not inside esm.webpack about stateless/statefull bundels
https://webpack.js.org/guides/package-exports/#providing-commonjs-and-esm-version-stateless
Reproduction Link
https://stackblitz.com/edit/stackblitz-starters-vnprfupv?file=index.mjs
Beta Was this translation helpful? Give feedback.
All reactions