Bundling svelte-notifications
This example demonstrates how to integrate the svelte-notifications repository, which includes a "lib" structure and JavaScript, bundled with Svelte Standalone.
You can also check how the component works: Live Demo
As you can see, even though svelte-notifications
uses "svelte": "^3.47.0"
, it still works.
How Does This Work?
Download the Code: I downloaded the
svelte-notifications
code from its repository.Create a Standalone Component: I created a standalone component using:
bashnpx standalone create
Named it
beyonk
and chose an embedding strategy.Paste the Code: I pasted the code from
svelte-notifications
into thebeyonk
component I created.Update Folder Structure: I swapped
$lib
tolib
since it was the new folder structure.Build the Component: I built the component using:
bashnpx standalone build
Key Takeaways
- Seamless Integration: Even though
svelte-notifications
was built for Svelte 3, it works flawlessly with Svelte Standalone. - Flexible Folder Structure: You can adapt existing projects by updating the folder structure (e.g.,
$lib
tolib
). - Quick Setup: The entire process is straightforward and requires minimal setup.
Try It Yourself
Follow the steps above to integrate your own Svelte components or third-party libraries with Svelte Standalone. If you run into any issues, feel free to open an issue or join the discussion.