svelte-worker

Svelte Worker

Svelte Compiler Service Worker

svelte-worker

Service Worker to compile Svelte Files

Examples

How to use

Copy the svelte-worker.js from dist folder into root of your project. Include it like below in your html. Once done you can import your svelte components directly, and they will be compiled on the fly.

<!DOCTYPE html>
<html>
  <head>
    <title>Hello Svelte</title>
  </head>
  <body>
    <div id="app"></div>

    <script src="/svelte-worker.js"></script>

    <script type="module">
      import MyComponent from "./MyComponent.svelte";
      new MyComponent({
        target: document.getElementById("app"),
      });
    </script>
  </body>
</html>

Top categories

Loading Svelte Themes