这是indexloc提供的服务,不要输入任何密码
Skip to content

fix: replace @repo/ui/tsconfig.json for with-svelte template to fix errors #10437

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

Closed
wants to merge 0 commits into from

Conversation

DoctorRyner
Copy link
Contributor

Description

I tested it with VS Code and Helix Editor and with current config, all export/imports of files, for instance in index.ts config, will result in a false error reporting of "Module does not exist", it seems to be happening because of miss configuration.

Testing Instructions

  1. Create project with bunx create-turbo@latest -e with-svelte
  2. Go to @repo/ui/src/index.ts and check if typescript gives you any errors (it should)
  3. Replace @repo/ui/tsconfig.json with:
{
  "extends": ["@repo/typescript-config/svelte.json", "./.svelte-kit/tsconfig.json"]
}

And check if import/export errors are gone in VS Code (it's the change made in this pull request)

@DoctorRyner DoctorRyner requested a review from a team as a code owner May 3, 2025 16:26
@turbo-orchestrator turbo-orchestrator bot added area: examples Improvements or additions to examples needs: triage New issues get this label. Remove it after triage labels May 3, 2025
Copy link

vercel bot commented May 3, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-basic-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2025 7:45pm
examples-designsystem-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2025 7:45pm
examples-gatsby-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2025 7:45pm
examples-kitchensink-blog ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2025 7:45pm
examples-native-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2025 7:45pm
examples-nonmonorepo ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2025 7:45pm
examples-svelte-web ❌ Failed (Inspect) May 6, 2025 7:45pm
examples-tailwind-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2025 7:45pm
examples-vite-web ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2025 7:45pm
turbo-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 6, 2025 7:45pm

Copy link

vercel bot commented May 3, 2025

@DoctorRyner is attempting to deploy a commit to the Vercel Team on Vercel.

A member of the Team first needs to authorize it.

@anthonyshew
Copy link
Contributor

Hi, thanks for the pR! It looks you've identified the right problem but I'm not seeing it fixed by this PR. I'm actually seeing a new error being introduced in tsconfig.json:

Cannot read file '/projects/debugs/svelte-example-bug/packages/ui/.svelte-kit/tsconfig.json'.

This makes sense since the UI package isn't a SvelteKit app itself, and doesn't generate that file. I'm not sure what the right fix is, though...

@DoctorRyner
Copy link
Contributor Author

DoctorRyner commented May 5, 2025

@anthonyshew oh, really? I didn't notice the new problem. I just saw that errors are checked properly now in my IDE and that build is successful.

I'm not knowledgeable and smart enough right now to figure out what the ideal fix would be, but the issue is pretty big since any person that wants to start a Svelte project with turbo will encounter it.

Copy link
Member

@chris-olszewski chris-olszewski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This does not work for me:

┌ @repo/ui#check-types > cache miss, executing 391a8a1acb1b2721 
│ 
│ 
│ > @repo/ui@0.0.0 check-types /private/tmp/svelte-test/packages/ui
│ > svelte-check --tsconfig ./tsconfig.json
│ 
│ 
│ ====================================
│ Loading svelte-check in workspace: /private/tmp/svelte-test/packages/ui
│ Getting Svelte diagnostics...
│ 
│ /private/tmp/svelte-test/packages/ui/tsconfig.json:1:1
│ Error: Cannot read file '/private/tmp/svelte-test/packages/ui/.svelte-kit/tsconfig.json'. 
│ 
│ 
│ ====================================
│ svelte-check found 1 error and 0 warnings in 1 file
│  ELIFECYCLE  Command failed with exit code 1.
│ command finished with error: command (/private/tmp/svelte-test/packages/ui) /Users/olszewski/.nvm/versions/node/v22.13.0/bin/pnpm run check-types exited
│  (1)
└────>

I do not think .svelte-kit gets created for @repo/ui when running svelte-package

@DoctorRyner
Copy link
Contributor Author

This does not work for me:

┌ @repo/ui#check-types > cache miss, executing 391a8a1acb1b2721 
│ 
│ 
│ > @repo/ui@0.0.0 check-types /private/tmp/svelte-test/packages/ui
│ > svelte-check --tsconfig ./tsconfig.json
│ 
│ 
│ ====================================
│ Loading svelte-check in workspace: /private/tmp/svelte-test/packages/ui
│ Getting Svelte diagnostics...
│ 
│ /private/tmp/svelte-test/packages/ui/tsconfig.json:1:1
│ Error: Cannot read file '/private/tmp/svelte-test/packages/ui/.svelte-kit/tsconfig.json'. 
│ 
│ 
│ ====================================
│ svelte-check found 1 error and 0 warnings in 1 file
│  ELIFECYCLE  Command failed with exit code 1.
│ command finished with error: command (/private/tmp/svelte-test/packages/ui) /Users/olszewski/.nvm/versions/node/v22.13.0/bin/pnpm run check-types exited
│  (1)
└────>

I do not think .svelte-kit gets created for @repo/ui when running svelte-package

Okay, now it seems I fixed the issue completely. Type checking works, check-types passes, build passes, everything looks nice.

@anthonyshew anthonyshew closed this May 6, 2025
@turbo-orchestrator turbo-orchestrator bot removed the area: examples Improvements or additions to examples label May 6, 2025
@anthonyshew
Copy link
Contributor

anthonyshew commented May 6, 2025

I'll be honest. I don't know how I just closed the branch and can't re-open. However, I have a different set of changes that I'm proposing to align better with what the Svelte team is letting me know to do.

I've opened a new PR: #10450

EDIT: Huh? I force-pushed?...?

anthonyshew added a commit that referenced this pull request May 6, 2025
### Description

Inspired by @DoctorRyner in #10437, a set of changes to make TypeScript
work better for the `with-svelte` example.

### Testing Instructions

This set of changes works correctly in my editor.

---------

Co-authored-by: Rainer Reinhardt <drryner@icloud.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs: triage New issues get this label. Remove it after triage
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants