As of Firefox 114, all modern JavaScript browsers and runtimes with worker support are now able to instantiate module workers. This is important for performance, as it significantly improves worker loading for cubing.js (requiring ⅓ as much code as before): https://github.com/cubing/cubing.js/issues/214
Due to the heavy complexity and maintenance burden of alternatives to module workers, cubing.js is dropping support for "classic" workers and there is no longer a "catch-all" fallback when worker instantiation fails. In removing this fallback, have carefully made sure cubing.js scrambles will continue work out of the box with all modern browsers, as well as the main runtimes that support web worker (node and deno). We have also tested compatibility against major bundlers. However, if you are passing cubing.js through your own choice of bundler, then it must correctly bundle the worker "entry file" using one of the following:
import.meta.resolve(…) — this is the only "officially supported" way that we plan to support indefinitely, and the only one that will work without showing a warning in the JavaScript console.
One of two variants of using new URL(…, import.meta.url) as an alternative to import.meta.resolve(…).
Steps to allow publishing a new version of
cubing.js
as soon as Firefox 114 (https://developer.mozilla.org/en-US/docs/Mozilla/Firefox/Releases/114) is available:postpublish
: https://github.com/cubing/cubing.js/blob/1916f2653d1224755241f729241dce1db7728e33/Makefile#L179-L184v0.37.0
Release notes:
cubing.js
(requiring ⅓ as much code as before): https://github.com/cubing/cubing.js/issues/214cubing.js
is dropping support for "classic" workers and there is no longer a "catch-all" fallback when worker instantiation fails. In removing this fallback, have carefully made surecubing.js
scrambles will continue work out of the box with all modern browsers, as well as the main runtimes that support web worker (node
anddeno
). We have also tested compatibility against major bundlers. However, if you are passingcubing.js
through your own choice of bundler, then it must correctly bundle the worker "entry file" using one of the following:import.meta.resolve(…)
— this is the only "officially supported" way that we plan to support indefinitely, and the only one that will work without showing a warning in the JavaScript console.new URL(…, import.meta.url)
as an alternative toimport.meta.resolve(…)
.esbuild
: https://github.com/evanw/esbuild/issues/312#issuecomment-952291570