Open valentinpalkovic opened 1 month ago
I don't think we should put effort into supporting middleware.js
. I wouldn't expect it to be easy to do, it's an undocumented functionality, and I personally think that users should configure it in their Vite config if they need it.
Describe the bug
Currently, the
preview-head.js
or themiddleware.js
file in your.storybook
folder doesn't automatically injected into the Vitest environment. Users would have to manually provide scripts inpreview-head.js
using the browser.testerscripts configuration and to import CSS files manually in theirvitest.setup.ts
file.Additionally, the
previewHead
hook in.storybook/main.js
is ignored as well and isn't considered.Reproduction steps
git clone https://github.com/pkp/ui-library.git
pnpm install
pnpm dlx storybook@0.0.0-pr-29241-sha-4da1ec12 add @storybook/experimental-addon-test
.storybook/preview-head.js
, which sets up aglobal.js
script and an external jquery script to provide the global$
variable. Additionally, thepreviewHead
preset in.storybook/main.js
is ignored as well as the proxying of a URL via.storybook/middleware.js
.