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

Doesn't work: causes compile errors even with basic example #2

Open
TylerRick opened this issue Sep 22, 2020 · 2 comments · May be fixed by #3
Open

Doesn't work: causes compile errors even with basic example #2

TylerRick opened this issue Sep 22, 2020 · 2 comments · May be fixed by #3

Comments

@TylerRick
Copy link

I was really excited to see a nice workaround for the lack of support for dynamic elements in Svelte.

But as soon as I even add this line to my project:

import { Input } from 'svelte-elements

, I got dozens of errors like this:

ERROR in ./node_modules/svelte-elements/dist/svelte-elements.es.js 85:6-26
"export 'add_binding_callback' was not found in 'svelte/internal'
    at HarmonyImportSpecifierDependency._getErrors (node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:109:11)
    at HarmonyImportSpecifierDependency.getErrors (node_modules/webpack/lib/dependencies/HarmonyImportSpecifierDependency.js:68:16)
    at Compilation.reportDependencyErrorsAndWarnings (node_modules/webpack/lib/Compilation.js:1463:22)
    at node_modules/webpack/lib/Compilation.js:1258:10
    at AsyncSeriesHook.eval [as callAsync] (eval at create (node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:15:1)
    at AsyncSeriesHook.lazyCompileHook (node_modules/tapable/lib/Hook.js:154:20)
    at Compilation.finish (node_modules/webpack/lib/Compilation.js:1253:28)
    at node_modules/webpack/lib/Compiler.js:672:17
    at _done (eval at create (node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at eval (eval at create (node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:104:22)

I tried to reproduce in a sandbox and got errors there too, though they were different errors:

Cannot read property 'ctx' of null
get_slot_context
/node_modules/svelte/internal/index.mjs:67:18
  64 | function get_slot_context(definition, ctx, $$scope, fn) {
  65 |     return definition[1] && fn
  66 |         ? assign($$scope.ctx.slice(), definition[1](fn(ctx)))
> 67 |         : $$scope.ctx;
     |                  ^
  68 | }
  69 | function get_slot_changes(definition, $$scope, dirty, fn) {
  70 |     if (definition[2] && fn) {

create_slot
/node_modules/svelte/internal/index.mjs:60:25
  57 | }
  58 | function create_slot(definition, ctx, $$scope, fn) {
  59 |     if (definition) {
> 60 |         const slot_ctx = get_slot_context(definition, ctx, $$scope, fn);
     |                         ^
  61 |         return definition[0](slot_ctx);
  62 |     }
  63 | }

...

What am I doing wrong? How do I get it to work? Is it just not compatible with current version of svelte?

@TylerRick
Copy link
Author

Okay, I cloned the repo, and ran

npm i
npm run build
npm run example

and the example worked. But it looks like it was using a really old version of svelte (svelte@3.3.0).

When I upgraded to svelte@3.26.0 then I get the same error I was getting in my own project:

[!] Error: 'add_binding_callback' is not exported by ../node_modules/svelte/internal/index.mjs
https://rollupjs.org/guide/en#error-name-is-not-exported-by-module-
../dist/svelte-elements.es.js (1:122)
1: import { SvelteComponent, init, safe_not_equal, create_slot, assign, element, set_attributes, listen as listen$1, insert, add_binding_callback, get_slot_changes, get_slot_context, get_spread_update, detach, run_all, exclude_internal_props, bubble, noop } from 'svelte/internal';
                                                                                                                             ^
2: 
3: function subscribe(node, listeners) {
Error: 'add_binding_callback' is not exported by ../node_modules/svelte/internal/index.mjs

TylerRick added a commit to TylerRick/svelte-elements that referenced this issue Sep 22, 2020
@TylerRick TylerRick linked a pull request Sep 22, 2020 that will close this issue
@TylerRick
Copy link
Author

Rebuilding dist after upgrading svelte should fix the problem. (add_binding_callback wasn't reference directly by this project's code, only from dist)

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

Successfully merging a pull request may close this issue.

1 participant