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

fix: ponyfill SharedWorker #109

Merged
merged 1 commit into from
Nov 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
"types": "dist/index.d.ts",
"exports": {
"./worker": {
"types": "./dist/common/webpack/worker/web-worker.d.ts",
"default": "./dist/common/webpack/worker/web-worker.js"
"types": "./dist/common/webpack/worker/web-worker.d.mts",
"default": "./dist/common/webpack/worker/web-worker.mjs"
},
".": {
"types": "./dist/index.d.ts",
Expand All @@ -22,7 +22,7 @@
"./dist/index.d.ts"
],
"worker": [
"./dist/common/webpack/worker/web-worker.d.ts"
"./dist/common/webpack/worker/web-worker.d.mts"
]
}
},
Expand Down Expand Up @@ -68,6 +68,7 @@
"@babel/preset-react": "^7.22.0",
"@babel/preset-typescript": "^7.22.0",
"@babel/runtime": "^7.22.0",
"@okikio/sharedworker": "^1.0.4",
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
"@sentry/webpack-plugin": "^2.7.1",
"@statoscope/webpack-plugin": "^5.27.0",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// eslint-disable-next-line camelcase
declare let __webpack_public_path__: string;

// @ts-expect-error ts does not find types in @okikio/sharedworker/@types/index.d.ts
ogonkov marked this conversation as resolved.
Show resolved Hide resolved
import {SharedWorkerPolyfill} from '@okikio/sharedworker';

class WebWorker extends Worker {
constructor(url: string | URL, options?: WorkerOptions) {
const objectURL = generateWorkerLoader(url);
Expand All @@ -9,7 +12,7 @@ class WebWorker extends Worker {
}
}

class SharedWebWorker extends SharedWorker {
class SharedWebWorker extends SharedWorkerPolyfill {
constructor(url: string | URL, options?: string | WorkerOptions) {
const objectURL = generateWorkerLoader(url);
super(objectURL, options);
Expand Down
Loading