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 5 - No matching export in in filea for import b #9925

Closed
niemyjski opened this issue Dec 15, 2023 · 9 comments
Closed

SVELTE 5 - No matching export in in filea for import b #9925

niemyjski opened this issue Dec 15, 2023 · 9 comments

Comments

@niemyjski
Copy link

Describe the bug

Once I upgraded to svelte 5 preview I became unable to compile and run my website due to compile errors. They all seem to stem from the same issue and it's blocking adoptions.

X [ERROR] No matching export in "node_modules/svelte/src/internal/index.js" for import "listen"

    node_modules/svelte-legos/dist/utilities/screenOrientation/index.js:3:9:
      3 │ import { listen } from "svelte/internal";
        ╵          ~~~~~~

7:06:06 AM [vite] error while updating dependencies:
Error: Build failed with 25 errors:
node_modules/svelte-legos/dist/actions/alertAction/Alert.js:1:18: ERROR: No matching export in "node_modules/svelte/src/internal/index.js" for import "append"
node_modules/svelte-legos/dist/actions/clickOutsideAction/index.js:1:9: ERROR: No matching export in "node_modules/svelte/src/internal/index.js" for import "listen"
node_modules/svelte-legos/dist/actions/clickToCopyAction/Clipboard.js:1:9: ERROR: No matching export in "node_modules/svelte/src/internal/index.js" for import "append"
node_modules/svelte-legos/dist/actions/infiniteScrollAction/index.js:1:9: ERROR: No matching export in "node_modules/svelte/src/internal/index.js" for import "listen"
node_modules/svelte-legos/dist/actions/loadingAction/Loader.js:1:9: ERROR: No matching export in "node_modules/svelte/src/internal/index.js" for import "append"
...
    at failureErrorWithLog (D:\ClientApp\node_modules\esbuild\lib\main.js:1650:15)
    at D:\ClientApp\node_modules\esbuild\lib\main.js:1058:25
    at D:\ClientApp\node_modules\esbuild\lib\main.js:1526:9
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    ```

TanStack/table#5213
ankurrsinghal/svelte-legos#115

Reproduction

clone and build https://github.com/exceptionless/Exceptionless/tree/feature/svelte-5-runes/src/Exceptionless.Web/ClientApp

Logs

VITE v5.0.9  ready in 866 ms

  ➜  Local:   http://localhost:5173/next
  ➜  Network: use --host to expose
  ➜  press h + enter to show help
X [ERROR] No matching export in "node_modules/svelte/src/internal/index.js" for import "SvelteComponent"

    node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:9:
      13 │ import { SvelteComponent, init, safe_not_equal, text, claim_text, insert_hydration, set_data, noop, detach, create_ssr_component, escape, validate_component, create_component, claim_com...
         ╵          ~~~~~~~~~~~~~~~

X [ERROR] No matching export in "node_modules/svelte/src/internal/index.js" for import "init"

    node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:26:
      13 │ import { SvelteComponent, init, safe_not_equal, text, claim_text, insert_hydration, set_data, noop, detach, create_ssr_component, escape, validate_component, create_component, claim_com...
         ╵                           ~~~~

X [ERROR] No matching export in "node_modules/svelte/src/internal/index.js" for import "safe_not_equal"

    node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:32:
      13 │ import { SvelteComponent, init, safe_not_equal, text, claim_text, insert_hydration, set_data, noop, detach, create_ssr_component, escape, validate_component, create_component, claim_com...
         ╵                                 ~~~~~~~~~~~~~~

X [ERROR] No matching export in "node_modules/svelte/src/internal/index.js" for import "claim_text"

    node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:54:
      13 │ import { SvelteComponent, init, safe_not_equal, text, claim_text, insert_hydration, set_data, noop, detach, create_ssr_component, escape, validate_component, create_component, claim_com...
         ╵                                                       ~~~~~~~~~~

X [ERROR] No matching export in "node_modules/svelte/src/internal/index.js" for import "insert_hydration"

    node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:66:
      13 │ import { SvelteComponent, init, safe_not_equal, text, claim_text, insert_hydration, set_data, noop, detach, create_ssr_component, escape, validate_component, create_component, claim_com...
         ╵                                                                   ~~~~~~~~~~~~~~~~

X [ERROR] No matching export in "node_modules/svelte/src/internal/index.js" for import "set_data"

    node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:84:
      13 │ import { SvelteComponent, init, safe_not_equal, text, claim_text, insert_hydration, set_data, noop, detach, create_ssr_component, escape, validate_component, create_component, claim_com...
         ╵                                                                                     ~~~~~~~~

X [ERROR] No matching export in "node_modules/svelte/src/internal/index.js" for import "noop"

    node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:94:
      13 │ ...t { SvelteComponent, init, safe_not_equal, text, claim_text, insert_hydration, set_data, noop, detach, create_ssr_component, escape, validate_component, create_component, claim_compo...
         ╵                                                                                             ~~~~

X [ERROR] No matching export in "node_modules/svelte/src/internal/index.js" for import "detach"

    node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:100:
      13 │ ...lteComponent, init, safe_not_equal, text, claim_text, insert_hydration, set_data, noop, detach, create_ssr_component, escape, validate_component, create_component, claim_component, m...
         ╵                                                                                            ~~~~~~

X [ERROR] No matching export in "node_modules/svelte/src/internal/index.js" for import "create_ssr_component"

    node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:108:
      13 │ ...nit, safe_not_equal, text, claim_text, insert_hydration, set_data, noop, detach, create_ssr_component, escape, validate_component, create_component, claim_component, mount_component,...
         ╵                                                                                     ~~~~~~~~~~~~~~~~~~~~

X [ERROR] No matching export in "node_modules/svelte/src/internal/index.js" for import "escape"

    node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:130:
      13 │ ...qual, text, claim_text, insert_hydration, set_data, noop, detach, create_ssr_component, escape, validate_component, create_component, claim_component, mount_component, transition_in,...
         ╵                                                                                            ~~~~~~

X [ERROR] No matching export in "node_modules/svelte/src/internal/index.js" for import "create_component"

    node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:158:
      13 │ ...dration, set_data, noop, detach, create_ssr_component, escape, validate_component, create_component, claim_component, mount_component, transition_in, transition_out, destroy_componen...
         ╵                                                                                       ~~~~~~~~~~~~~~~~

X [ERROR] No matching export in "node_modules/svelte/src/internal/index.js" for import "claim_component"

    node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:176:
      13 │ ..., noop, detach, create_ssr_component, escape, validate_component, create_component, claim_component, mount_component, transition_in, transition_out, destroy_component } from 'svelte/...
         ╵                                                                                        ~~~~~~~~~~~~~~~

X [ERROR] No matching export in "node_modules/svelte/src/internal/index.js" for import "mount_component"

    node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:193:
      13 │ ... detach, create_ssr_component, escape, validate_component, create_component, claim_component, mount_component, transition_in, transition_out, destroy_component } from 'svelte/internal';
         ╵                                                                                                  ~~~~~~~~~~~~~~~

X [ERROR] No matching export in "node_modules/svelte/src/internal/index.js" for import "transition_in"

    node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:210:
      13 │ ... detach, create_ssr_component, escape, validate_component, create_component, claim_component, mount_component, transition_in, transition_out, destroy_component } from 'svelte/internal';
         ╵                                                                                                                   ~~~~~~~~~~~~~

X [ERROR] No matching export in "node_modules/svelte/src/internal/index.js" for import "transition_out"

    node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:225:
      13 │ ... detach, create_ssr_component, escape, validate_component, create_component, claim_component, mount_component, transition_in, transition_out, destroy_component } from 'svelte/internal';
         ╵                                                                                                                                  ~~~~~~~~~~~~~~

X [ERROR] No matching export in "node_modules/svelte/src/internal/index.js" for import "destroy_component"

    node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:241:
      13 │ ... detach, create_ssr_component, escape, validate_component, create_component, claim_component, mount_component, transition_in, transition_out, destroy_component } from 'svelte/internal';
         ╵                                                                                                                                                  ~~~~~~~~~~~~~~~~~

7:32:47 AM [vite] error while updating dependencies:
Error: Build failed with 16 errors:
node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:9: ERROR: No matching export in "node_modules/svelte/src/internal/index.js" for import "SvelteComponent"
node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:26: ERROR: No matching export in "node_modules/svelte/src/internal/index.js" for import "init"
node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:32: ERROR: No matching export in "node_modules/svelte/src/internal/index.js" for import "safe_not_equal"
node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:54: ERROR: No matching export in "node_modules/svelte/src/internal/index.js" for import "claim_text"
node_modules/@tanstack/svelte-table/build/lib/index.mjs:13:66: ERROR: No matching export in "node_modules/svelte/src/internal/index.js" for import "insert_hydration"
...
    at failureErrorWithLog (D:\ClientApp\node_modules\esbuild\lib\main.js:1650:15)
    at D:\ClientApp\node_modules\esbuild\lib\main.js:1058:25
    at D:\ClientApp\node_modules\esbuild\lib\main.js:1526:9
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)


### System Info

```shell
System:
    OS: Windows 11 10.0.22631
    CPU: (24) x64 AMD Ryzen 9 5900X 12-Core Processor
    Memory: 5.95 GB / 31.91 GB
  Binaries:
    Node: 21.4.0 - C:\Program Files\nodejs\node.EXE
    npm: 10.1.0 - ~\AppData\Roaming\npm\npm.CMD
    pnpm: 8.11.0 - ~\AppData\Roaming\npm\pnpm.CMD
  Browsers:
    Edge: Chromium (120.0.2210.61)
    Internet Explorer: 11.0.22621.1

Severity

blocking all usage of svelte

@trueadm
Copy link
Contributor

trueadm commented Dec 15, 2023

Svelte 5 doesn't export a listen function from its internals anymore (it was something Svelte 4 internals exposed). This looks like an issue with svelte-legos as it's depending on an internal API that no longer exists.

@trueadm trueadm closed this as completed Dec 15, 2023
@niemyjski
Copy link
Author

niemyjski commented Dec 15, 2023

@trueadm that might be the case but when you say svelte 5 has 100% backwards compatibility. It sure doesn't look like it, internal api or not, it was exported to a public api surface. A shim should be there with some warnings logs

@dummdidumm
Copy link
Member

dummdidumm commented Dec 15, 2023

100% backwards compatible if you're using public API. Internal APIs are subject to change in every release. We can't shim the old runtime, it has completely changed how it works.

@niemyjski
Copy link
Author

Seems like you could have at least left them in place and had empty functions / polyfills that throw what an alternative might be... Fact is they still were exported and public, people are using them these are two popular svelte libraries. who knows how many libraries are using them. Perhaps having a linter that errors would go a long way from having people use these.

I totally get it from your perspective. I'm a framework / library developer myself.

@dummdidumm
Copy link
Member

The error already tells you that there is something wrong, I don't think having an empty function that errors would make this any easier.
We could maybe look into shimming a few selected high-usage internals, depending on what is commonly used across frameworks, but that's about it - and even that makes me nervous because people could think "oh ok I'm going to keep using those internal methods" and that just postpones the time of breakage a bit.

@niemyjski
Copy link
Author

Agreed, can we also call this out on the 5.0 breaking changes and alert text saying don't use imports from this package? I'm also kind of curious why these developers would have thought it ok to take on internal package references, are these behaviors not exposed via public apis?

@dominikg
Copy link
Member

appearantly a lot of people do. https://github.com/search?q=svelte%2Finternal&type=code but i'm not sure how to get more explicit than naming it svelte/internal.

Maybe we can look into import maps with # refs so that svelte5 internals are truly opaque?

We do communicate that svelte5 is a complete rewrite, so there's no mistake or implication that anything internal will stay the same. Adding it to the list of breaking changes would be redundant.

@niemyjski
Copy link
Author

redundant yes, but communication is always a good thing :)

@niemyjski
Copy link
Author

I'd also ask why so many people are using the internal api, what is the public api possibly missing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants