Skip to content

Cannot use untrack in a .svelte.js or .svelte.ts file #14883

Closed as not planned
Closed as not planned
@feus4177

Description

@feus4177

Describe the bug

Want to use explicit dependencies with $effect like demonstrated here. Since this will be used across the app, it would be nice to factor it out into a .svelte.js module. However, the untrack function does not seem to get added correctly to those files. As a result an error gets thrown:

ReferenceError: untrack is not defined
    at $effect (playground:output:3369:4)
    at update_reaction (playground:output:1917:57)
    at update_effect (playground:output:2043:19)
    at flush_queued_effects (playground:output:2152:7)
    at flush_queued_root_effects (playground:output:2131:5)
    at process_deferred (playground:output:2183:3)

Reproduction

https://svelte.dev/playground/f9fec2106b954d02b23e7f710aa62e80?version=5.16.0

Logs

No response

System Info

System:
    OS: macOS 15.2
    CPU: (10) arm64 Apple M1 Max
    Memory: 1.53 GB / 64.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.9.0 - /opt/homebrew/bin/node
    npm: 10.8.3 - /opt/homebrew/bin/npm
    pnpm: 9.5.0 - /opt/homebrew/bin/pnpm
  Browsers:
    Chrome: 131.0.6778.205
    Safari: 18.2
  npmPackages:
    svelte: ^5.11.1 => 5.11.1

Severity

blocking an upgrade

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions