Skip to content
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

svelte-kit is unable to pickup nested dependency from a locally linked component library module #304

Closed
bhvngt opened this issue Apr 1, 2022 · 2 comments
Labels
bug Something isn't working triage Awaiting triage by a project member

Comments

@bhvngt
Copy link

bhvngt commented Apr 1, 2022

Describe the bug

I have a locally installed svelte-kit component library project that I have linked it to my main svelte-kit app project.

I have used "my-lib": "link:../my-lib/package" to link this project to my svelte-kit app package.json.

When I build my main project using svelte-kit build, its unable to pickup the transient dependencies used by my component library.

A simple workaround is to install the dependency to my main project. Is this how it is expected to work. zI have raised this as
a bug because it feels like it is leaking the self-containment of my component library.

Reason I have raised this issue under this repo is because, I thought it might be related to #263

Reproduction

/~https://github.com/bhvngt/svelte-dependency-issue/

Logs

Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'dayjs' imported from svelte-dependency-issue/my-app/.svelte-kit/output/server/entries/pages/__layout.svelte.js
 at new NodeError (node:internal/errors:371:5)
    at packageResolve (node:internal/modules/esm/resolve:930:9)
    at moduleResolve (node:internal/modules/esm/resolve:976:18)
    at defaultResolve (node:internal/modules/esm/resolve:1078:11)
    at ESMLoader.resolve (node:internal/modules/esm/loader:530:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:251:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:79:40)
    at link (node:internal/modules/esm/module_job:78:36)

System Info

System:
    OS: macOS 12.3
    CPU: (10) arm64 Apple M1 Pro
    Memory: 773.31 MB / 32.00 GB
    Shell: 3.4.0 - /opt/homebrew/bin/fish
  Binaries:
    Node: 16.14.0 - ~/Library/Caches/fnm_multishells/74691_1648750303350/bin/node
    npm: 8.3.1 - ~/Library/Caches/fnm_multishells/74691_1648750303350/bin/npm
  Browsers:
    Chrome: 100.0.4896.60
    Chrome Canary: 102.0.4977.0
    Firefox: 97.0.1
    Firefox Developer Edition: 99.0
    Safari: 15.4

Severity

annoyance

@bhvngt bhvngt added bug Something isn't working triage Awaiting triage by a project member labels Apr 1, 2022
@bluwy
Copy link
Member

bluwy commented Apr 2, 2022

Perhaps this is related to sveltejs/kit#4261. Does it happen only when the linked library is a Svelte library?

@bhvngt
Copy link
Author

bhvngt commented Apr 2, 2022

I tried importing a sample lodash module - chunk in a separate node esm module based local project. I am getting a similar error when I try to do svelte-kit build with that project.

sveltejs/kit#4261 seems to be highlighting the same issue. As I too faced this issue in my rushjs + pnpm project.

I guess I will close this issue here as it seems to be an issue with the svelte-kit project.

@bhvngt bhvngt closed this as completed Apr 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage Awaiting triage by a project member
Projects
None yet
Development

No branches or pull requests

2 participants