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

Importing in Svelte #26

Open
Cranbaerry opened this issue Dec 24, 2022 · 1 comment
Open

Importing in Svelte #26

Cranbaerry opened this issue Dec 24, 2022 · 1 comment

Comments

@Cranbaerry
Copy link

I'm having trouble importing this library to svelte
Here's the code that I used

import superplaceholder from 'superplaceholder';
superplaceholder({
		el: document.querySelector('input'),
		sentences: ['Something to show', 'Another thing to show']
	});

The error is

Cannot find module 'superplaceholder' imported from 'D:/Documents/Svelte/aol/src/routes/+page.svelte'

How do I import this library?

@chinchang
Copy link
Owner

This is because superplaceholder doens't export anything. You can import it without expecting out of it and then use window.superplaceholder instead:

import 'superplaceholder';
window.superplaceholder({
		el: document.querySelector('input'),
		sentences: ['Something to show', 'Another thing to show']
	});

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