Skip to content
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

The builder depends on internal use of handlebars that will be removed in Storybook 8.4 #136

Closed
JReinhold opened this issue Oct 4, 2024 · 1 comment · Fixed by #137
Closed

Comments

@JReinhold
Copy link

JReinhold commented Oct 4, 2024

For Storybook 8.4 we're doing a lot of internal cleanup and optimisation (see storybookjs/storybook#29038).

As part of my work to replace the express dev-server with polka, I wanted to try out if that worked with RSBuild, because the server is exposed to the builders via the start() function. However I never got that far, because RSBuild fails with the following error in the latest alpha releases of Storybook 8.4.0:

=> Failed to build the preview
TypeError: (0 , import_common.handlebars) is not a function
    at getVirtualModules (./node_modules/storybook-builder-rsbuild/dist/index.js:195:66)
    at async iframe_rsbuild_config_default (./node_modules/storybook-builder-rsbuild/dist/index.js:371:72)
    at async rsbuild (./node_modules/storybook-builder-rsbuild/dist/index.js:656:23)
    at async Module.start (./node_modules/storybook-builder-rsbuild/dist/index.js:691:18)
    at async storybookDevServer (./node_modules/@storybook/core/dist/core-server/index.cjs:37195:11)
    at async buildOrThrow (./node_modules/@storybook/core/dist/core-server/index.cjs:36205:12)
    at async buildDevStandalone (./node_modules/@storybook/core/dist/core-server/index.cjs:38385:78)
    at async withTelemetry (./node_modules/@storybook/core/dist/core-server/index.cjs:36950:12)
    at async dev (./node_modules/@storybook/core/dist/cli/bin/index.cjs:2877:3)
    at async r.<anonymous> (./node_modules/@storybook/core/dist/cli/bin/index.cjs:2929:74)

This is because we've removed handlebars from the Storybook core/common exports, as it was unnecessary. It was never intended to be used as a public API, but it's fair that you perhaps just copied the logic from the Webpack builder.

You should be able to to the same migration that @ndelangen we did for the Webpack builder in storybookjs/storybook#29208. High-level, that PR:

  1. converts the handlebar template to a regular JS file
  2. uses '{{someVariable}}' for stuff that needs replacement
  3. Uses regular replaceAll() calls to do the variable replacements.
@JReinhold JReinhold changed the title RSBuild depends on internal use of handlebars that will be removed in Storybook 8.4 The builder depends on internal use of handlebars that will be removed in Storybook 8.4 Oct 4, 2024
@fi3ework
Copy link
Member

fi3ework commented Oct 4, 2024

Thanks @JReinhold for the kind remind. I'll do the same migration quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants