Skip to content

Svelte snapshot was not found after trying to load script snapshot #2602

@datstarkey

Description

@datstarkey

Describe the bug

Issue

Depending on the order of typescript files opened in a monorepo, the typescript server becomes unable to resolve svelte file snapshots stating:

-Svelte Plugin- Svelte snapshot was not found after trying to load script snapshot for

The IDE shows:

Cannot find module './MyComponent.svelte' or its corresponding type declarations."

image

This eventually breaks intelisense within the monorepo and cannot be fixed without entirely restarting vscode. restarting the TS server/Svelte server/Host extensions doesn't seem to fix anything.

Reproduction

Repo https://github.com/datstarkey/svelte-snapshot-failure

Replication

To replicate, install the project in the root with pnpm i

Enable TS server Logging

Navigate to shared/src/lib/index.ts in your IDE

Everything looks okay

Navigate to web/src/lib/index.ts in your IDE

Everything looks okay

Leave web/src/lib/index.ts open and close vscode
Reopen vscode at web/src/lib/index.ts

Everything looks okay

Navigate to shared/src/lib/index.ts

Error: Cannot find module './MyComponent.svelte' or its corresponding type declarations.ts(2307)

TS Server Log Error:

info 55 [14:57:24.357] -Svelte Plugin- Svelte snapshot was not found after trying to load script snapshot for /Users/jake/Repos/svelte-snapshot-failure/shared/src/lib/MyComponent.svelte

Only way to fix is to restart VScode

Differences

I've tried this with and without project references, path alias's and installing the project as pnpm workspace package, and it always gives the same error

Expected behaviour

A monorepo project should work regardless of which project is opened first.

System Info

  • OS: Mac & windows
  • IDE: vscode

Which package is the issue about?

No response

Additional Information, eg. Screenshots

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixedFixed in master branch. Pending production release.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy