Worker scripts are able to require() builtin modules and those in the local node_modules directory, but they cannot require files specified with a relative path such as ./local_script.js.
I also noticed that the __filename variable is not defined in worker scripts.
I would like worker scripts to require files relative to the directory of the worker scripts themselves, not relative to the directory of the running program's source file, any third party libraries that load workers with tiny-workers, or the working directory. Such behavior seems to be aligned with nodejs style require() functionality.
Worker scripts are able to
require()builtin modules and those in the localnode_modulesdirectory, but they cannot require files specified with a relative path such as./local_script.js.I also noticed that the
__filenamevariable is not defined in worker scripts.I would like worker scripts to require files relative to the directory of the worker scripts themselves, not relative to the directory of the running program's source file, any third party libraries that load workers with tiny-workers, or the working directory. Such behavior seems to be aligned with nodejs style
require()functionality.