Worker env access
I'm building a web worker to post activity tracking to our API, although it doesn't seem like the worker is getting access to any of my environment variables. Some context:
- Worker is stored in
- Worker is exposed via plugin which imports worker using suffix
-
Adding a
Is there any other way to get the env variable into my worker?
- Worker is stored in
/assets/js/activity.worker.js- Worker is exposed via plugin which imports worker using suffix
import ActivityWorker from '@/assets/js/activity.worker?worker-
import.meta.env has the following value in worker:Adding a
VITE_CORE_API env variable to my .env file adds the value correctly to import.meta.env in the worker, although I would prefer not duplicating my existing CORE_API env var just for this.Is there any other way to get the env variable into my worker?
