diff --git a/e2e/tests/manifest-content.test.ts b/e2e/tests/manifest-content.test.ts index e344d07d..5ba736c4 100644 --- a/e2e/tests/manifest-content.test.ts +++ b/e2e/tests/manifest-content.test.ts @@ -599,4 +599,29 @@ describe('Manifest Content', () => { }, ); }); + + it('should respect the action field in the manifest without a popup', async () => { + const project = new TestProject(); + project.setConfigFileConfig({ + manifest: { + action: { + default_title: 'Hello world', + }, + }, + }); + + await project.build(); + + expect(await project.getOutputManifest()).toMatchInlineSnapshot(` + { + "action": { + "default_title": "Hello world", + }, + "description": "Example description", + "manifest_version": 3, + "name": "E2E Extension", + "version": "0.0.0", + } + `); + }); }); diff --git a/src/core/types/external.ts b/src/core/types/external.ts index f8aa6945..439697cc 100644 --- a/src/core/types/external.ts +++ b/src/core/types/external.ts @@ -468,17 +468,13 @@ export interface ExcludableEntrypoint { export type UserManifest = Partial< Omit< Manifest.WebExtensionManifest, - | 'action' | 'background' - | 'browser_action' | 'chrome_url_overrides' | 'devtools_page' | 'manifest_version' | 'options_page' | 'options_ui' | 'sandbox' - | 'page_action' - | 'popup' | 'sidepanel' | 'sidebar_action' > diff --git a/src/core/utils/manifest.ts b/src/core/utils/manifest.ts index f7a23350..850f041b 100644 --- a/src/core/utils/manifest.ts +++ b/src/core/utils/manifest.ts @@ -214,18 +214,23 @@ function addEntrypoints( config.outDir, '.html', ); - const options: Manifest.ActionManifest = { - default_icon: popup.options.defaultIcon, - default_title: popup.options.defaultTitle, - browser_style: popup.options.browserStyle, - }; + const options: Manifest.ActionManifest = {}; + if (popup.options.defaultIcon) + options.default_icon = popup.options.defaultIcon; + if (popup.options.defaultTitle) + options.default_title = popup.options.defaultTitle; + if (popup.options.browserStyle) + options.browser_style = popup.options.browserStyle; if (manifest.manifest_version === 3) { manifest.action = { + ...(manifest.action ?? {}), ...options, default_popup, }; } else { - manifest[popup.options.mv2Key ?? 'browser_action'] = { + const key = popup.options.mv2Key ?? 'browser_action'; + manifest[key] = { + ...(manifest[key] ?? {}), ...options, default_popup, };