Emotion changed to use exports map, and esbuild wasn't pivking the right entry anymore,
resulting in react not being detected, and thus not bundled, and thus missing at runtime!
I changed the tsup/esbuild config to prefer the ESM version, and this seems to have fixed the issue.
Many thanks to @Anderist for the assist!
cc @ndelangen this fixes annoying errors like:
```
error - ../../lib/blocks/dist/index.js
Module build failed: Error: ENOENT: no such file or directory, open '/Users/tom/GitHub/storybookjs/storybook/lib/blocks/dist/index.js'
```
- We prebundle the entire lib/ui with tsup.
- We tell the manager builder to serve lib/ui/dist as part of staticDirs
- We add the prebundled runtime to the main template as script reference
This works! Webpack builds ONLY the addons, not the manager UI!
But there's a problem... the manager gets react components injected into it.
These react components do not share the same version of react.
That causes the well know: hooks-call problems.
So left to investigate:
- Will this really work? Does bundling lib/ui and everything it needs break nothing?
- How to force a single version of react? (all dependencies normally coming from the manager, really)