in src/manifest.ts [6:56]
export async function getManifest(): Promise<Manifest.WebExtensionManifest> {
const pkg = (await fs.readJSON(r('package.json'))) as typeof PkgType;
// update this file to update this manifest.json
// can also be conditional based on your need
const manifest: Manifest.WebExtensionManifest = {
manifest_version: 2,
name: pkg.displayName || pkg.name,
version: pkg.version,
description: pkg.description,
browser_action: {
default_icon: './assets/logo.png',
default_popup: './dist/popup/index.html',
},
options_ui: {
page: './dist/options/index.html',
open_in_tab: true,
chrome_style: false,
},
background: {
page: './dist/background/index.html',
persistent: false,
},
icons: {
16: './assets/logo.png',
48: './assets/logo.png',
128: './assets/logo.png',
},
permissions: ['tabs', 'storage', 'activeTab', 'http://*/', 'https://*/'],
content_scripts: [
{
matches: ['http://*/*', 'https://*/*'],
js: ['./dist/contentScripts/index.global.js'],
},
],
web_accessible_resources: ['dist/contentScripts/style.css'],
};
if (isDev) {
// for content script, as browsers will cache them for each reload,
// we use a background script to always inject the latest version
// see src/background/contentScriptHMR.ts
delete manifest.content_scripts;
manifest.permissions?.push('webNavigation');
// this is required on dev for Vite script to load
manifest.content_security_policy = `script-src 'self' http://localhost:${port}; object-src 'self'`;
}
return manifest;
}