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
With Vite + React configured, importing a LESS file called "x.stories.less" causes story rendering to fail with the following error: "(intermediate value)(...) is not a function". The same problem affects CSS files called "x.stories.css".
Clone the repo, do npm install, then npm run start. When visiting the only story, you will get an error saying "(intermediate value)(...) is not a function".
In package.json, change the storybook package versions to 8.5.6, then npm install and npm run start. The error message is gone and the story works correctly.
Revert back to 8.5.7, then rename sample.stories.less to sample.less, and change the corresponding import in sample.stories.js. This also fixes the problem (as HMR stripping is not applied)
This occurs in 8.6.0 and 8.5.7, but not 8.5.6 so the culprit appears to be this PR: #30562, which adds HMR stripping to all files named x.stories.y. For this reason I suspect this bug affects many configurations - probably any where the builder supports HMR.
Workarounds
Renaming the LESS file so it doesn't match the "x.stories.less" pattern, or
Downgrading to Storybook 8.5.6
Potential fixes
Attempting to exclude stylesheet files (.css, .less, .scss) from HMR stripping would probably fix this issue (although as I'm not 100% sure what the benefit of HMR stripping is, it might be better to fix the HMR stripping to fix these special cases).
The text was updated successfully, but these errors were encountered:
Describe the bug
With Vite + React configured, importing a LESS file called "x.stories.less" causes story rendering to fail with the following error: "(intermediate value)(...) is not a function". The same problem affects CSS files called "x.stories.css".
Reproduction link
/~https://github.com/duncan-thacker/storybook-hmr-bug
Reproduction steps
npm install
, thennpm run start
. When visiting the only story, you will get an error saying "(intermediate value)(...) is not a function".package.json
, change the storybook package versions to8.5.6
, thennpm install
andnpm run start
. The error message is gone and the story works correctly.8.5.7
, then renamesample.stories.less
tosample.less
, and change the corresponding import insample.stories.js
. This also fixes the problem (as HMR stripping is not applied)System
Additional context
Likely cause
This occurs in 8.6.0 and 8.5.7, but not 8.5.6 so the culprit appears to be this PR: #30562, which adds HMR stripping to all files named
x.stories.y
. For this reason I suspect this bug affects many configurations - probably any where the builder supports HMR.Workarounds
Potential fixes
Attempting to exclude stylesheet files (.css, .less, .scss) from HMR stripping would probably fix this issue (although as I'm not 100% sure what the benefit of HMR stripping is, it might be better to fix the HMR stripping to fix these special cases).
The text was updated successfully, but these errors were encountered: