-
Notifications
You must be signed in to change notification settings - Fork 2.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(storybook): move tsconfig one level up #17749
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
☁️ Nx Cloud ReportCI is running/has finished running commands for commit 43cef5f. As they complete they will appear below. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch ✅ Successfully ran 1 targetSent with 💌 from NxCloud. |
packages/storybook/src/generators/configuration/lib/util-functions.ts
Outdated
Show resolved
Hide resolved
2727902
to
284245c
Compare
f4e23d5
to
a8ff8c3
Compare
Local testing works - like create workspace, add storybook, build and run storybook. Needs more testing though. Do not merge yet |
a8ff8c3
to
086d650
Compare
086d650
to
8e2bbce
Compare
b8fd534
to
f700ca1
Compare
f700ca1
to
ae387d6
Compare
ae387d6
to
43cef5f
Compare
This pull request has already been merged/closed. If you experience issues related to these changes, please open a new issue referencing this pull request. |
See this PR for context: #17745
This solves the vite paths issue.
vite-tsconfig-paths
plugin will not runresolversByDir
for the.storybook
dir, but rather for the project's root. So it does not take into account the paths included in the.storybook/tsconfig.file
. Then, it looks one level up to find resolvers.The
vite-tsconfig-paths
is setting up the resolvers to match thetsconfig.json
settings under the.storybook
directory, and different ones for thetsconfig.*.json
files it’s finding in the project root. Since we're excluding.stories.*
files in the project's root tsconfig, then it's failing.Now, if we move the
.storybook/tsconfig.json
file to betsconfig.storybook.json
file in the project's root, then thevite-tsconfig-paths
plugin will be able to resolve the paths, then, since it will be at the root of the project.Is it ok to remove
tsconfig.json
from the.storybook
dir?Yes, since only
@storybook/angular
is using.storybook/tsconfig.json
, the other frameworks ignore it. And@storybook/angular
resolves the paths correctly, so we'll keep it as is for Angular projectsWhy do we need a
tsconfig
file for Storybook anyway?Because we want to exclude
.stories.*
files from the ts compilation if we're building the actual project. And our builders import specifically thetsconfig.app|lib.json
file. But of course, we want to include the.stories.*
files for Storybook builder and server. So, we need this extra file toinclude
the stories that thetsconfig.app|lib.json
fileexludes
.TODO (done ✅ ):
Tested the following:
Related Issue(s)
Fixes #17257 #17156