Skip to content

In development mode, $lib always points to the currently running app, rather than the app which declared it. #2879

@antony

Description

@antony

Describe the bug

If I have two sveltekit apps:

monorepo_root/
├─ application/
│  ├─ foo.js
├─ library/
│  ├─ lib/
│  │  ├─ bar.js

and I import from '$lib/bar.js' in component, it works in isolation, for instance if I run the sveltekit app inside library, but if component is a component linked to app, component' reference to $lib points to app's $lib instead.

System Info

System:
    OS: Linux 5.8 Ubuntu 20.10 (Groovy Gorilla)
    CPU: (8) x64 AMD Ryzen 7 4700U with Radeon Graphics
    Memory: 8.89 GB / 30.85 GB
    Container: Yes
    Shell: 5.8 - /bin/zsh
  Binaries:
    Node: 16.13.0 - ~/.volta/tools/image/node/16.13.0/bin/node
    Yarn: 1.22.10 - ~/.volta/tools/image/yarn/1.22.10/bin/yarn
    npm: 8.1.0 - ~/.volta/tools/image/node/16.13.0/bin/npm
  Browsers:
    Brave Browser: 96.1.32.106
    Chrome: 96.0.4664.45
    Chromium: 96.0.4664.45
    Firefox: 90.0
  npmPackages:
    @sveltejs/kit: next => 1.0.0-next.196 
    svelte: ^3.42.6 => 3.44.1

Severity

makes monorepo development impractical

serious, but I can work around it.

Additional Information

I can work around it by falling back to ../../...

However, this is fairly impractical, so I think aliasing $lib always to the local project somehow is the optimal fix.

Metadata

Metadata

Assignees

No one assigned

    Labels

    p2-nice-to-haveSvelteKit cannot be used by a small number of people, quality of life improvements, etc.

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions