nx: Storybook - does not support swc compiler

Current Behavior

The latest Nx versions introduced the swc compiler as an option. Currently, adding the "compiler": "swc" to the project.json file under storybook configuration fails because babel remains in webpack loaders.

Expected Behavior

Storybook should support swc compiler

Steps to Reproduce

  • Create a React app
  • Add Storybook configuration
  • Add "compiler": "swc" under the project’s storybook configuration -> options
  • Run storybook

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Reactions: 15
  • Comments: 19 (10 by maintainers)

Most upvoted comments

Ahhh I see what you’re saying! 😃 Well, the thing is that we want to keep the experience as close to the native Storybook as possible, to avoid any glitches and loose ends that may appear in the long run. So I think it makes sense to install the package that Storybook suggests.

On another note, however, I think that we could add the compiler option to the storybook target, for non-buildable libs that do not have a compiler already chosen, since they do not have a build target.

@mandarini should the storybook support "compiler": "swc" configuration like apps/libs? If so, that still doesn’t seem to work

Ye, its mainly for stories. It will work btw if you provide "compiler": "swc" in your options but it will still preserve the babel one, resulting in build errors.

That’s the issue.