You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vite build issue: "default" is not exported by "node_modules/@testing-library/dom/dist/@testing-library/dom.esm.js", imported by "node_modules/@testing-library/user-event/dist/esm/_interop/dtl.js"
#1160
Closed
yannbf opened this issue
Sep 15, 2023
· 4 comments
· Fixed by #1162
Storybook has a browser-compatible package @storybook/testing-library which encapsulates @testing-library/dom^9.0.0 and @testing-library/user-event@^14.0.0. A few hours ago there was a release of 14.5.0 which introduced a breaking change when building Vite applications that contained that new version. The issue is related to a default export that does not exist in @testing-library/dom, which is imported from @testing-library/user-event.
p.s.: The reproduction has an overrides field to force the version of user-event, as I have released a fix (downgraded the user-event dependency version) to @storybook/testing-library
Prerequisites
Open stackblitz
2.1 See a failure right away:
2.2 Or kill the process and run npm run build-storybook and see the failure
It might commonly happen in Storybook projects, as they use testing utilities that contain @testing-library/user-event, but it's definitely not a bug in Storybook. It happens when building projects with Vite, where Rollup tries to extract a default export from @testing-library/dom, however it does not exist. I am able to reproduce the same issue in a Vite project without Storybook.
Storybook has a browser-compatible package
@storybook/testing-library
which encapsulates@testing-library/dom^9.0.0
and@testing-library/user-event@^14.0.0
. A few hours ago there was a release of 14.5.0 which introduced a breaking change when building Vite applications that contained that new version. The issue is related to a default export that does not exist in @testing-library/dom, which is imported from @testing-library/user-event.The issues were detected in a CI run that you can find here: https://app.circleci.com/pipelines/github/storybookjs/storybook/59307/workflows/7b75b77e-19a8-4b99-9fff-ea6516a48f33/jobs/577382/parallel-runs/32?filterBy=FAILED
Reproduction example
https://stackblitz.com/edit/github-thblwz?file=package.json&preset=node
p.s.: The reproduction has an
overrides
field to force the version of user-event, as I have released a fix (downgraded the user-event dependency version) to@storybook/testing-library
Prerequisites
2.1 See a failure right away:
2.2 Or kill the process and run

npm run build-storybook
and see the failureActual behavior
User-event version
14.5.0
The text was updated successfully, but these errors were encountered: