parcel-plugin-web-ext-tool
Version:
A parcel plugin for web-ext.
28 lines (21 loc) • 494 B
JavaScript
const webExt = require("web-ext");
const { getConfig } = require("./config");
let runner = null;
module.exports = bundler => {
if (!bundler.options.watch) {
return;
};
bundler.on("bundled", async (bundle) => {
if (runner) {
runner.reloadAllExtensions();
return;
}
const config = await getConfig();
runner = await webExt.cmd.run(config, {
shouldExitProgram: true,
});
runner.registerCleanup(() => {
runner = null;
});
});
};