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

Unexpected token error in REPL but not locally #354

Open
janosh opened this issue Jun 27, 2022 · 6 comments
Open

Unexpected token error in REPL but not locally #354

janosh opened this issue Jun 27, 2022 · 6 comments

Comments

@janosh
Copy link
Contributor

janosh commented Jun 27, 2022

Describe the bug

svelte-multiselect stopped working in the REPL in v5.0.0. The previous v4.0.6 release is working fine.

The error message v5 raises is: Unexpected token (Note that you need plugins to import files that are not JavaScript)

Sadly the REPL gives no stack traces. I've been looking through the changes I introduced between these 2 releases but nothing jumps out. v5 works fine when used locally too. I was also looking through the REPL compiler's JS output but couldn't spot any issues. Any debugging advice would be great.

Reproduction

v:4.0.6 (working): https://svelte.dev/repl/4279890dae0942caa860e74f2e7a8a6f?version=3.48.0
v5.0.0 (broken): https://svelte.dev/repl/ea202bd627134d898802a11cfaf8ff0e?version=3.48.0

Logs

No response

System Info

REPL

Severity

annoyance

@janosh
Copy link
Contributor Author

janosh commented Jun 27, 2022

Error originally reported in janosh/svelte-multiselect#80.

@baseballyama
Copy link
Member

baseballyama commented Jun 27, 2022

I think this is because of this change.

https://github.com/janosh/svelte-multiselect/pull/75/files#diff-7d86c55b55f23806b2be4051d790e7c775fd5fa4e1ad3fc2da59eb51ce25c0e9R3
(Important point is thattype has been removed)

I took diff between 4.0.6 and 5.0.0.
(Left side is 4.0.6, the right side is 5.0.0)

image

And due to import './';, REPL fetches data from https://unpkg.com/browse/svelte-multiselect@5.0.0/ but it returns HTML and REPL throw parse error because it expects JavaScript.

@Conduitry Conduitry transferred this issue from sveltejs/svelte Jun 27, 2022
@Conduitry
Copy link
Member

Transferring this to the sites repo, as this is apparently an issue in how the REPL resolves imports, not in Svelte itself.

@janosh
Copy link
Contributor Author

janosh commented Jul 5, 2022

@baseballyama I thought that strange remnant from the type import might be the issue too at first but later v5 releases of svelte-multiselect don't have that any more. The generated package/MultiSelect.svelte looks like this now but the REPL import still fails.

<script>import { createEventDispatcher } from 'svelte';
import { get_label, get_value } from './';
import CircleSpinner from './CircleSpinner.svelte';
// ...

@gyurielf
Copy link

Same here:
https://svelte.dev/repl/0a87b0b710ab473fb7368dc260160ae6?version=3.50.1
It works fine outside of the REPL.

@janosh
Copy link
Contributor Author

janosh commented Oct 17, 2022

Just noticed that version 7.0.2 of svelte-multiselect now successfully runs in the Svelte REPL.

@gyurielf Apparently the fix was to remove a circular import between src/lib/{index.ts<->MultiSelect.svelte}. See janosh/svelte-multiselect#121 (comment).

@Conduitry Maybe this also helps point at how to make the REPL more robust?

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