svelte-toast icon indicating copy to clipboard operation
svelte-toast copied to clipboard

`svelteToast` is not defined

Open zerodevx opened this issue 2 years ago • 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 https://github.com/zerodevx/svelte-toast/issues/73#issuecomment-1502597667

zerodevx avatar Apr 11 '23 07:04 zerodevx

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

zerodevx avatar Apr 11 '23 07:04 zerodevx

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

vbernabe avatar Apr 11 '23 17:04 vbernabe

Using svelte-routing, specifically.

CameronNemo avatar Apr 13 '23 05:04 CameronNemo

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'

zerodevx avatar Apr 15 '23 05:04 zerodevx