Closed bashmish closed 2 months ago
Latest commit: 8552a4a4054b097d6063f87ec82087ea54609ae1
The changes in this PR will be included in the next version bump.
Not sure what this means? Click here to learn what changesets are.
Click here if you're a maintainer who wants to add another changeset to this PR
What I did
Explainer
Same file was imported by a module inside
rootDir
and a module outsiderootDir
in such a way that from the browser perspective it's 2 different files. I ran into this when playing with MDX in thestorybook-builder
, where some deps located in root monorepo node_modules were importing React in a different way to the way I was importing in my subpackage (where subpackage was a root dir). As a result, prebundled React was loaded twice from 2 different URLs:For
rootDir=packages/storybook-builder/
browser requests looked like:inside
:http://localhost:3000/node_modules/.prebundled_modules/react.mjs
outside
:http://localhost:3000/__wds-outside-root__/2/packages/storybook-builder/node_modules/.prebundled_modules/react.mjs
So basically for outside modules it was resolved relative to their own root path
/__wds-outside-root__/2
.It's not only a React problem, but also:
This was such a rollercoaster this bug, I almost gave up at some point, because I needed to learn lots of details about WDS internals and rollup adapter specifically, fun stuff :D