bare-worker 4.1.1 → 4.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -22,11 +22,17 @@ const protocol = module.protocol.extend({
22
22
 
23
23
  const { main, imports, resolutions } = bundle
24
24
 
25
- const resolved = Module.resolve('bare-worker', new URL(main), { protocol, imports, resolutions })
26
-
27
25
  const cache = Object.create(null)
28
26
 
29
- const Worker = Module.load(resolved, { protocol, cache }).exports
27
+ let Worker
28
+
29
+ try {
30
+ const resolved = Module.resolve('bare-worker', new URL(main), { protocol, imports, resolutions })
31
+
32
+ Worker = Module.load(resolved, { protocol, imports, resolutions, cache }).exports
33
+ } catch {
34
+ Worker = require('..')
35
+ }
30
36
 
31
37
  const channel = Channel.from(handle, { interfaces: [Worker.MessagePort] })
32
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-worker",
3
- "version": "4.1.1",
3
+ "version": "4.1.3",
4
4
  "description": "Higher-level worker threads for JavaScript",
5
5
  "exports": {
6
6
  ".": "./index.js",