From 5bf7a706945c1fe5dbf9a6b8b4f471be2699e22b Mon Sep 17 00:00:00 2001 From: abhijithvijayan <34790378+abhijithvijayan@users.noreply.github.com> Date: Fri, 25 Oct 2019 17:46:04 +0530 Subject: [PATCH] write background property to manifest dynamically --- src/manifests/chrome.json | 4 ---- src/manifests/firefox.json | 3 --- src/manifests/opera.json | 4 ---- webpack.config.js | 5 ++++- 4 files changed, 4 insertions(+), 12 deletions(-) diff --git a/src/manifests/chrome.json b/src/manifests/chrome.json index a810bf4..b88bace 100644 --- a/src/manifests/chrome.json +++ b/src/manifests/chrome.json @@ -4,10 +4,6 @@ "short_name": "Sample Name", "description": "Sample description", "homepage_url": "https://github.com/abhijithvijayan/web-extension-starter", - "background": { - "persistent": false, - "scripts": ["js/background.js"] - }, "manifest_version": 2, "minimum_chrome_version": "49", "permissions": ["tabs", "storage", "http://*/*", "https://*/*"], diff --git a/src/manifests/firefox.json b/src/manifests/firefox.json index 112d060..8f91f7b 100644 --- a/src/manifests/firefox.json +++ b/src/manifests/firefox.json @@ -4,9 +4,6 @@ "short_name": "Sample Name", "description": "Sample description", "homepage_url": "https://github.com/abhijithvijayan/kutt-extension", - "background": { - "scripts": ["js/background.js"] - }, "manifest_version": 2, "permissions": ["tabs", "storage", "http://*/*", "https://*/*"], "content_security_policy": "script-src 'self' 'unsafe-eval'; object-src 'self'", diff --git a/src/manifests/opera.json b/src/manifests/opera.json index 897b731..f1f9ffd 100644 --- a/src/manifests/opera.json +++ b/src/manifests/opera.json @@ -6,10 +6,6 @@ "short_name": "Sample Name", "description": "Sample description", "homepage_url": "https://github.com/abhijithvijayan/web-extension-starter", - "background": { - "persistent": false, - "scripts": ["js/background.js"] - }, "manifest_version": 2, "minimum_opera_version": "36", "permissions": ["tabs", "storage", "http://*/*", "https://*/*"], diff --git a/webpack.config.js b/webpack.config.js index fe47b34..52ca2cb 100644 --- a/webpack.config.js +++ b/webpack.config.js @@ -37,12 +37,15 @@ module.exports = { { from: 'src/assets', to: 'assets' }, { from: `src/manifests/${process.env.TARGET}.json`, - // expose and write the allowed env vars on the compiled bundle transform(content, path) { // generates the manifest file using the package.json informations return Buffer.from( JSON.stringify({ version: process.env.npm_package_version, + background: { + persistent: false, + scripts: ['js/background.bundle.js'], + }, ...JSON.parse(content.toString()), }) );