sveltejs / svelte

Cybernetically enhanced web apps
https://svelte.dev
MIT License
78.19k stars 4.09k forks source link

Bug Missing "./types/runtime/internal/lifecycle" export in "svelte" package #7839

Closed snk-js closed 2 years ago

snk-js commented 2 years ago

Describe the bug

I started to play around with Svelte rendering graph nodes and edges using SVG, but something gone wrong or svelte may not been displaying a clear error message

line of the file and repository that occurs the error

I just imported the edge component to my Node component and that error started to pop up:

Reproduction

the file being imported in the component: https://github.com/snk-js/svelte-visualized-graph-algorithms/blob/bug/missing-export-in-svelte-package/src/components/Edge.svelte

the component that importing the Bug https://github.com/snk-js/svelte-visualized-graph-algorithms/blob/bug/missing-export-in-svelte-package/src/components/Node.svelte

Logs

"./types/runtime/internal/lifecycle" export in "svelte" package
Error: Missing "./types/runtime/internal/lifecycle" export in "svelte" package
    at bail (file:///home/dragonfly/myprojects/synonymous_algorithm/node_modules/vite/dist/node/chunks/dep-3ffe6dd0.js:33647:8)
    at resolve (file:///home/dragonfly/myprojects/synonymous_algorithm/node_modules/vite/dist/node/chunks/dep-3ffe6dd0.js:33724:10)
    at resolveExports (file:///home/dragonfly/myprojects/synonymous_algorithm/node_modules/vite/dist/node/chunks/dep-3ffe6dd0.js:34780:12)
    at resolveDeepImport (file:///home/dragonfly/myprojects/synonymous_algorithm/node_modules/vite/dist/node/chunks/dep-3ffe6dd0.js:34798:31)
    at tryNodeResolve (file:///home/dragonfly/myprojects/synonymous_algorithm/node_modules/vite/dist/node/chunks/dep-3ffe6dd0.js:34515:20)
    at Context.resolveId (file:///home/dragonfly/myprojects/synonymous_algorithm/node_modules/vite/dist/node/chunks/dep-3ffe6dd0.js:34288:28)
    at Object.resolveId (file:///home/dragonfly/myprojects/synonymous_algorithm/node_modules/vite/dist/node/chunks/dep-3ffe6dd0.js:40973:46)
    at async TransformContext.resolve (file:///home/dragonfly/myprojects/synonymous_algorithm/node_modules/vite/dist/node/chunks/dep-3ffe6dd0.js:40742:23)
    at async normalizeUrl (file:///home/dragonfly/myprojects/synonymous_algorithm/node_modules/vite/dist/node/chunks/dep-3ffe6dd0.js:37522:34)
    at async TransformContext.transform (file:///home/dragonfly/myprojects/synonymous_algorithm/node_modules/vite/dist/node/chunks/dep-3ffe6dd0.js:37662:47)

System Info

System:
    OS: Linux 5.10 Ubuntu 20.04.4 LTS (Focal Fossa)
    CPU: (12) x64 AMD Ryzen 5 5600X 6-Core Processor
    Memory: 10.22 GB / 12.44 GB
    Container: Yes
    Shell: 5.0.17 - /bin/bash
  Binaries:
    Node: 18.7.0 - ~/.nvm/versions/node/v18.7.0/bin/node
    Yarn: 1.22.19 - ~/.nvm/versions/node/v18.7.0/bin/yarn
    npm: 8.15.0 - ~/.nvm/versions/node/v18.7.0/bin/npm
  npmPackages:
    svelte: ^3.44.0 => 3.49.0

Severity

blocking all usage of svelte

gurmanbh commented 1 year ago

Facing the same issue. How was this resolved?

snk-js commented 1 year ago

Facing the same issue. How was this resolved?

Look carefully to your imports

pezdel commented 1 year ago

for me I auto imported getContext and had it picked
import { getContext } from 'svelte/types/runtime/internal/lifecycle'; instead of the normal from 'svelte' import

Aurumaker72 commented 1 year ago

for me I auto imported getContext and had it picked import { getContext } from 'svelte/types/runtime/internal/lifecycle'; instead of the normal from 'svelte' import

Worrying. Especially with the VSCode Svelte extension installed, you'd expect Intellisense to actually give proper quickhints.

justuswilhelm commented 1 year ago

Had the same issue when receiving an autocomplete from the svelte language server. Thankfully, searching for this error quickly brought me to this issue here.

dominikg commented 1 year ago

@justuswilhelm is this with svelte4 or svelte3?

svelte4 types are declared differently and going to https://www.npmjs.com/package/svelte?activeTab=code types/index.d.ts you can see that getContext is there.

but https://www.npmjs.com/package/svelte/v/3.59.1?activeTab=code you can see that types/runtime/index.d.ts indeed exports it from svelte/internal which caused this issue. It should be fixed with 4

justuswilhelm commented 1 year ago

@justuswilhelm is this with svelte4 or svelte3?

I just checked my package.json and it looks like I'm still on v3. Woops! I suppose I should be upgrading soon.