msw-storybook-addon
msw-storybook-addon copied to clipboard
Breaks on building Storybook
While building the Storybook, the bundler (Vite) emits an error like this:
[commonjs--resolver] No known conditions for "./native" specifier in "msw" package
This is because of the code here. While it'll work without any problem when not built, this will break on browser builds because...
- The bundler doesn't know whether
IS_REACT_NATIVE
is true or false at build time, therefore it should try to bundle both versions. - However, since the bundler is building for browsers and that enables the
browser
export condition, the entry resolves to null and it errors.
This problem should be fixed by adding separate entries for each browser and native.