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

The requested module does not provide an export named 'default' #2

Open
worldpeaceenginelabs opened this issue Jan 21, 2023 · 5 comments

Comments

@worldpeaceenginelabs
Copy link

Hi!
Is it a bug or am i using it wrong?

image

@michaelphipps
Copy link
Contributor

This is interesting. I'm thinking there is something specific about your setup that is causing this issue. I would be curious to see the contents of your package.json.

I don't see the same error in my installation or when I test it on Svelte REPL https://svelte.dev/repl/35517043583c40e6aa706ce59a2a691d?version=3.55.1

Can you offer any further information that will help replicate the error?

@hahuang65
Copy link

I'll chime in. I believe this is specific to Sveltekit, and won't be reproduced on pure Svelte.

I'm not 100% on this, but I'm assuming it's similar to this issue AgnosticUI/agnosticui#238

@michaelphipps
Copy link
Contributor

@hahuang65 thanks for that insight - I'll try it out in SvelteKit and see what happens!

@michaelphipps
Copy link
Contributor

It appears that the problem is svelte-qrious does not support the ESM format.

I'll be honest. I don't really know what that means at the moment!

Anyway, that means to use Svelte QRious in SvelteKit, you will need to instruct vite to pre-bundle it.

In your vite.config.js file, that looks something like this (the optimizeDeps section):

import { sveltekit } from '@sveltejs/kit/vite';

const config = {
...
	optimizeDeps: {
		include: ['Qrious']
	}
...
};

export default config;

Then you should be able to use Svelte Qrious as documented

@hahuang65
Copy link

@michaelphipps I've followed your instructions above, but I get

0:50:59 PM [vite-plugin-svelte] ssr compile in progress ...
TypeError: Cannot read properties of undefined (reading 'QRious')

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

3 participants