Enable hot reloading for content script and background script (service worker) in MV3.
// background
import * as mv3 from 'mv3-hot-reload'
mv3.utils.setConfig({
isDev: true, // false: Disable hot reloading.
})
mv3.background.init()
// your code...
// content.ts
import * as mv3 from 'mv3-hot-reload'
mv3.content.init()
// your code...
Example:
"watch:src": "webpack --config webpack/webpack.dev.js --watch",
+ "watch:dist": "mv3-hot-reload",
+ "dev": "concurrently yarn:watch:*",
The implementation of hot reloading in mv3 refers to theprimone/violet.
MIT