Storybook 9 and custom swcrc support #19
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.