how to implement/create a background script?
From my understanding, you will just need to specify your background script in your manifest file. Something like
{ ...[this is your custom manifest, not the generated one in dist] "background": { "service_worker": "src/background/index.ts", "type": "module" } }
Then in the dist folder, if you check service-worker-loader.js, you will see your background script imported there. I have only tested it in the dev command, not sure if extra set up is needed for production build.
service-worker-loader.js
This is exactly correct! No extra setup needed for production.
this will work perfectly?
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
how to implement/create a background script?
From my understanding, you will just need to specify your background script in your manifest file. Something like
Then in the dist folder, if you check
service-worker-loader.js
, you will see your background script imported there. I have only tested it in the dev command, not sure if extra set up is needed for production build.This is exactly correct! No extra setup needed for production.
this will work perfectly?