How to import injectable providers in a web worker?

I want to create a web worker which will do a background sync task. I have gotten a simple web worker to work with a sync-worker.js file.

However I cannot access any providers in the .js file.


import { RunsheetTable } from '../providers/database/runsheet-table';

would result in a Uncaught SyntaxError: Unexpected token import at runtime.

I can’t change it to a .ts file as it will get bundled along with the main.js file.

How do I import and use providers in my web worker ?