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

Bug: Importing Oak inside a Web Worker prevents the Worker from working at all #424

Open
dhardtke opened this issue Oct 29, 2021 · 1 comment
Labels
bug Something isn't working needs investigation Something that needs to be looked at

Comments

@dhardtke
Copy link

dhardtke commented Oct 29, 2021

$ deno --version
deno 1.15.3 (release, x86_64-pc-windows-msvc)
v8 9.5.172.19
typescript 4.4.2

main.ts

const worker = new Worker(
  new URL("./worker.ts", import.meta.url).href,
  {
    type: "module",
    deno: {
      namespace: true,
    },
  },
);

worker.postMessage(null);

worker.ts

import * as Oak from "https://deno.land/x/oak@v9.0.1/mod.ts";
console.assert(Boolean(Oak));

self.onmessage = () => {
  console.log("This is never printed as long as the import is present.");
};

self.onerror = (e) => {
  console.error(e);
}

Expected output:
This is never printed as long as the import is present..

Actual output:

$ deno run --unstable --no-check --allow-all main.ts

Instead of the expected output nothing is printed and it seems the worker is stuck / not properly started.

Motivation:
I have a project where Oak is imported in a deps.ts file that contains all dependencies in the project. Hence, it is also included within the worker to consume other dependencies.

@kitsonk kitsonk added bug Something isn't working needs investigation Something that needs to be looked at labels Nov 12, 2021
@dhardtke
Copy link
Author

This issue is still present using the latest version of Oak (1.10.0) and Deno (1.17.1)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working needs investigation Something that needs to be looked at
Projects
None yet
Development

No branches or pull requests

2 participants