-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Actions are not mocked for interaction tests in production build #206
Comments
I was pointed to this file: https://github.com/storybookjs/storybook/blob/next/addons/interactions/src/preset/preview.ts Debugging, I found, that the The name So the culprit here is esbuild, point 5 at https://esbuild.github.io/api/#minify-considerations says:
So as an easy fix, we could enable the keep names option in esbuild. |
Great sleuthing, @bodograumann. @ghengeveld it looks like you wrote most of this, and are probably the most familiar. Can you think of any other ways https://github.com/storybookjs/storybook/blob/0b3e2ea7066def01de91126892e2aafe3f2dd540/addons/interactions/src/preset/preview.ts#L23 could be done other than looking at the |
The following will work. const { mergeConfig } = require('vite');
module.exports = {
..., // other configs
async viteFinal(config) {
return mergeConfig(config, {
esbuild: {
keepNames: true,
},
});
},
}; |
Can we get a fix in for this, @IanVS / @ghengeveld? We could enable keepNames in the vite builder by default. |
Thanks, I had lost track of this. @bodograumann would you be willing to submit a PR? It should just be a matter of adding the option to builder-vite/packages/builder-vite/vite-config.ts Lines 36 to 51 in a824bef
I'm a bit pre-occupied at the moment with helping to get the vite builder working in storybook 7.0. |
After switching from webpack builder to this vite builder, the action args are not mocked correctly anymore.
Reproduction: https://github.com/bodograumann/storybook-vite-action-interaction
Use as:
Now the Interactions tab will be marked as failed with the message:
In contrast, when running with
yarn storybook
, everything is fine.The text was updated successfully, but these errors were encountered: