Avoid buggy getProjectRoot()#14
Merged
valentinpalkovic merged 2 commits intostorybookjs:mainfrom Apr 1, 2025
Merged
Conversation
valentinpalkovic
approved these changes
Mar 28, 2025
Contributor
|
Thank you for opening the PR!
That's an excellent question. Unfortunately, I can't recall its existence. Let's remove it and see how this change is affecting others. But I think it is reasonable to remove it! |
Contributor
|
fyi: I will merge and release a patch on Monday! |
Contributor
Author
|
@valentinpalkovic Thank you! The same code does the same thing in |
Contributor
|
I've pinged a college of mine to ask for a second opinion. Hopefully, we can get it merged asap! |
ndelangen
approved these changes
Apr 1, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
[closes storybookjs/storybook/issues/14042]
Storybook fails to compile TypeScript when I use git worktrees and yarn.
This setup has two interesting properties:
.git/directory.node_modules/.So getProjectRoot() doesn't find my top-level directory via either path. But it does find a
node_modules/! There's anode_modulesinside theaddon-webpack5-compiler-babelfolder. SogetProjectRoot()returns,"/home/adam.hooper/src/myproject/.yarn/cache/@storybook-addon-webpack5-compiler-babel-npm-3.0.5-9ba7eaab05-32249b0dbf.zip/". And my TypeScript files outside of that directory don't match the include, so they don't get compiled.Workaround:
STORYBOOK_PROJECT_ROOT=/ yarn storybookcan get Storybook up and running.Solution: heck, why do we have
"include"in the first place? It looks like it's designed to translate all files; and we'll get the same effect if we simply remove it. This PR removes it.Side-effects: now the babel loader ignores
STORYBOOK_PROJECT_ROOT. That env variable isn't documented, and it's unlikely somebody out there usesSTORYBOOK_PROJECT_ROOTto filter out files for Babel translation.