I have two modules: client and processor.
client module is for the web browser window this contains a module that can be used in the browser window.processor module is a web worker that contains the code to do web worker work.In my client I trigger the web worker like this:
export class WebWorker {
constructor() {
const url = new URL('../../processor/src/worker.ts', import.meta.url);
this.worker = new Worker(url);
}
}
Is there a way for me to load the URL string using an import/alias so I would do something like this:
const url = new URL('@org/processor/worker.ts', import.meta.url);
I would like to do this so I can decouple the two modules, currently as it is, if it cannot find the url it throws an error.
I have something similar in my package.json
{
"dependencies": {
"@org/processor": "file:./path/to/processor",
}
}