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

Uncaught SyntaxError: ambiguous indirect export: default #28

Open
norricorp opened this issue Dec 3, 2022 · 5 comments
Open

Uncaught SyntaxError: ambiguous indirect export: default #28

norricorp opened this issue Dec 3, 2022 · 5 comments

Comments

@norricorp
Copy link

norricorp commented Dec 3, 2022

Hello,
I wonder if you can help with this.

Here are snippets of my code

  import Time, { svelteTime } from "svelte-time";
  import { dayjs } from "svelte-time";
......
{#if first}
    <p>
      {first.publish_date} 
      <time
          use:svelteTime="{{
          timestamp: first.publish_date,
        }}"
      />
     </p>
{/if}

without the svelteTime code, all is well, first.publish_date is printed.
With the extra code, I get an error in firefox console of above. It is a line two of days.js.

So I changed first.publish_date with "2021-02-14" and got the same error. Obviously this works in the repl.

Any ideas what I am doing wrong?

@norricorp
Copy link
Author

Just to add, I commented out the time tag. Still same error.
So then I commented out the import lines and now it works. (obvioulsy without the svelte-time code)

@metonym
Copy link
Owner

metonym commented Dec 3, 2022

What set-up are you using? If SvelteKit, what version?

@norricorp
Copy link
Author

norricorp commented Dec 4, 2022

Hi @metonym, thanks for getting back so quickly.
I am not using sveltekit. I am using svelte 3.49.0. Running on windows 10.
Is there anything you want?

@norricorp
Copy link
Author

So the problem is "Usage with Vite".
I needed to add

 optimizeDeps: {
      include: ["dayjs/plugin/relativeTime.js"],
    },

to vite.config.js

Perhaps edit docs to say if get ambiguous indirect error then make sure vite.config.js is updated.

@metonym
Copy link
Owner

metonym commented Dec 11, 2022

Glad you got it working. Marking this as a dupe of #27, #24.

FWIW, I believe that @sveltejs/vite-plugin-svelte version >=1.3.0 will automatically optimize these dependencies, meaning it's no longer required.

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

2 participants