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

Trying to use the CreateServiceWorkerMLCEngine using Vite project but it doesn't work #641

Open
v7Chord opened this issue Nov 27, 2024 · 1 comment

Comments

@v7Chord
Copy link

v7Chord commented Nov 27, 2024

test.zip

I have created the same project that you have provided using service-worker using Vite.

The problem is that the CreateServiceWorkerMLCEngine never initialized.

console.log("CREATING ENGINE: CreateServiceWorkerMLCEngine...."); // <<<<<<------------

const engine: webllm.ServiceWorkerMLCEngine =
  await webllm.CreateServiceWorkerMLCEngine(selectedModel, {
    initProgressCallback: initProgressCallback,
  });

console.log("CREATING ENGINE: CreateServiceWorkerMLCEngine....CREATED"); // <<<<<<------------ NEVER GOES HERE.....
@v7Chord
Copy link
Author

v7Chord commented Nov 27, 2024

I found how to configure property using Vite
test.zip

  • I move the sw.tsx file to the root of folder
  • I have installed the npm package register-service-worker in order to register the sw.tsx
  • i have placed the "await navigator.serviceWorker.ready" before calling the CreateServiceWorkerMLCEngine

I have included the solution files.

You can close the issue.

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

1 participant