write background property to manifest dynamically

This commit is contained in:
abhijithvijayan 2019-10-25 17:46:04 +05:30
parent 3fc3d01d17
commit 5bf7a70694
4 changed files with 4 additions and 12 deletions

View File

@ -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://*/*"],

View File

@ -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'",

View File

@ -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://*/*"],

View File

@ -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()),
})
);