zerodevx/svelte-toast

`svelteToast` is not defined

Opened this issue · 4 comments

          @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)

@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?

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

Using svelte-routing, specifically.

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'