Skip to content

Added configuration code that scours file path/tree for .swcrc file#9

Closed
jglanz wants to merge 1 commit intostorybookjs:mainfrom
jglanz:feature/swcrc-override
Closed

Added configuration code that scours file path/tree for .swcrc file#9
jglanz wants to merge 1 commit intostorybookjs:mainfrom
jglanz:feature/swcrc-override

Conversation

@jglanz
Copy link
Copy Markdown

@jglanz jglanz commented Nov 19, 2024

Added configuration code that scours file path/tree for .swcrc file

If it finds one then it loads that file from disk and takes precedence over the code config.

The simplest/clearest reason for this is swc config breaking changes, for instance, I received this error (swc error env and jsc.target cannot be used together), which triggered this idea (and is resolved with this feature)

…g directory tree for an `.swcrc` config file.

If it finds one then it loads that file from disk and takes precidence over the code config
@valentinpalkovic
Copy link
Copy Markdown
Contributor

Hi @jglanz

Thank you for your contribution!

Do you think this change is a breaking change and should hence be released as a major version?

@Sidnioulz
Copy link
Copy Markdown
Member

Hey folks,

Revisiting this PR as Storybook 9 is out and there would be a breaking change for this addon to be updated. I'm opening a PR for Storybook 9 and am including a revisited commit for this here PR: #19

I did not go ahead with exactly the commit provided here because I found a few blind spots:

  • __dirname caused many node_modules folders to be parsed, and it's unlikely that we'd want to pick up a stranded swcrc in such folders
  • The recursive algorithm did not stop at the project root and could also end up picking up a globally
  • Our default syntax had changed in the meantime and the PR needed rebasing anyway

@jglanz feel free to try it out and let me know if it fits your needs.

Thanks,

@Sidnioulz
Copy link
Copy Markdown
Member

The other PR is now merged!

@Sidnioulz Sidnioulz closed this Sep 2, 2025
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.

3 participants