You haven't shared a project file so I'm guessing, but I suspect you may need to generate a URL that is relative to the page URL, otherwise it takes it relative to the script being run, which is in a subfolder when exported. Something like new URL("worker.js", location.href).toString()
should do the trick.
However I'd add you probably don't need to use runtime.createWorker()
any more - IIRC all modern browsers now support creating nested workers, and that method mainly existed to work around browsers that didn't support that.