Skip to content

Conversation

Sidnioulz
Copy link
Member

@Sidnioulz Sidnioulz commented Aug 18, 2025

Work done

Ports to Storybook 9.
Adds support for injecting local .swcrc file into default options.

Allows closing #9.

Testing

I started a React webpack project, installed an older version of the addon and monkey-patched the build with this addon. I could correctly get a local .swcrc file included in my CWD or project root dir, or a file pointed at through process.env.SWC_CONFIG_PATH.

Storybook ran as expected. The preset hook was called as expected. Me messing up options to something non-compatible caused errors as expected. I've never used SWC myself so I may be missing subtleties and would still encourage testing in a realistic project :)

Notes

@jonniebigodes if this PR goes ahead, we'd want to document that process.env.SWC_CONFIG_PATH can be set to customise the path of the swcrc file, which is slightly redundant with what the addon does (lets users customise config) but at least deep-merges their user config with our default config, resulting in slightly less work for them.

I'm waiting to see what Valentin thinks of this PR before creating additional issues and PRs for this though.

BREAKING CHANGE: Storybook 9.0 or newer is now required.
BREAKING CHANGE: Your swcrc file is now taken into account, so
your default SWC config may differ from what it previously was.
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 this pull request may close these issues.

2 participants