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

svelteToast is not defined #75

Open
zerodevx opened this issue Apr 11, 2023 · 4 comments
Open

svelteToast is not defined #75

zerodevx opened this issue Apr 11, 2023 · 4 comments

Comments

@zerodevx
Copy link
Owner

          @zerodevx here is how I use the library

Import

import {SvelteToast, toast} from '@zerodevx/svelte-toast'
const options = {}

Set the component
<SvelteToast {options} />

On Form Submit
toast.push('Hello world!')

This is the only Error from Web Console and the page is showing a blank white screen:
Uncaught ReferenceError: svelteToast is not defined <anonymous> http://localhost:8080/build/bundle.js?version=xxx:78489 [bundle.js:78489:1](http://localhost:8080/build/bundle.js?version=xxx) <anonymous> http://localhost:8080/build/bundle.js?version=xxx:78489

There seemed to be no other errors on the command line

Originally posted by @vbernabe in #73 (comment)

@zerodevx
Copy link
Owner Author

@vbernabe moving your issue into a new one.

Don't look like you're using SvelteKit. How's your setup like? Are you using Svelte?

@vbernabe
Copy link

Hi @zerodevx I am using Svelte and not SvelteKit..

@CameronNemo
Copy link

Using svelte-routing, specifically.

@zerodevx
Copy link
Owner Author

Not too familiar with svelte-routing tbh. For Svelte setups, the tooling should be "svelte-aware", ie. tooling knows when it's dealing with a Svelte component and picks up the correct code. Try importing the compiled code instead and see if the error still occurs:

import { toast, SvelteToast } from '@zerodevx/svelte-toast/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

No branches or pull requests

3 participants