API / wxt / MainWorldContentScriptEntrypointOptions
Interface: MainWorldContentScriptEntrypointOptions
Source: packages/wxt/src/types.ts:810
Contents
Extends
Extended by
Properties
allFrames?
optionalallFrames?:PerBrowserOption<boolean|undefined>
Source: packages/wxt/src/types.ts:755
See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
Default
falseInherited from
BaseContentScriptEntrypointOptions.allFrames
cssInjectionMode?
optionalcssInjectionMode?:PerBrowserOption<"manifest"|"manual"|"ui">
Source: packages/wxt/src/types.ts:778
Customize how imported/generated styles are injected with the content script. Regardless of the mode selected, CSS will always be built and included in the output directory.
"manifest"- Include the CSS in the manifest, under the content script'scssarray."manual"- Exclude the CSS from the manifest. You are responsible for manually loading it onto the page. Usebrowser.runtime.getURL("content-scripts/<name>.css")to get the file's URL"ui"- Exclude the CSS from the manifest. CSS will be automatically added to your UI when callingcreateShadowRootUi
Default
'manifest'Inherited from
BaseContentScriptEntrypointOptions.cssInjectionMode
exclude?
optionalexclude?:string[]
Source: packages/wxt/src/types.ts:673
List of target browsers to exclude this entrypoint from. Cannot be used with include. You must choose one of the two options.
Default
undefinedInherited from
BaseContentScriptEntrypointOptions.exclude
excludeGlobs?
optionalexcludeGlobs?:PerBrowserOption<string[] |undefined>
Source: packages/wxt/src/types.ts:749
See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
Default
[ ]Inherited from
BaseContentScriptEntrypointOptions.excludeGlobs
excludeMatches?
optionalexcludeMatches?:PerBrowserOption<string[] |undefined>
Source: packages/wxt/src/types.ts:737
See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
Default
[ ]Inherited from
BaseContentScriptEntrypointOptions.excludeMatches
globalName?
optionalglobalName?:string|boolean| ((entrypoint) =>string)
Source: packages/wxt/src/types.ts:713
The variable name for the IIFE in the output bundle.
This option is relevant for scripts inserted into the page context where the default IIFE variable name may conflict with an existing variable on the target page. This applies to content scripts with world=MAIN, and others, such as unlisted scripts, that could be dynamically injected into the page with a <script> tag.
Available options:
true: automatically generate a name for the IIFE based on the entrypoint namefalse: Output the IIFE without a variable name, making it anonymous. This is the safest option to avoid conflicts with existing variables on the page.string: Use the provided string as the global variable name.function: A function that receives the entrypoint and returns a string to use as the variable name.
Default
falseInherited from
BaseContentScriptEntrypointOptions.globalName
include?
optionalinclude?:string[]
Source: packages/wxt/src/types.ts:666
List of target browsers to include this entrypoint in. Defaults to being included in all builds. Cannot be used with exclude. You must choose one of the two options.
Default
undefinedInherited from
BaseContentScriptEntrypointOptions.include
includeGlobs?
optionalincludeGlobs?:PerBrowserOption<string[] |undefined>
Source: packages/wxt/src/types.ts:743
See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
Default
[ ]Inherited from
BaseContentScriptEntrypointOptions.includeGlobs
matchAboutBlank?
optionalmatchAboutBlank?:PerBrowserOption<boolean|undefined>
Source: packages/wxt/src/types.ts:729
See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
Default
falseInherited from
BaseContentScriptEntrypointOptions.matchAboutBlank
matches?
optionalmatches?:PerBrowserOption<string[]>
Source: packages/wxt/src/types.ts:717
Inherited from
BaseContentScriptEntrypointOptions.matches
matchOriginAsFallback?
optionalmatchOriginAsFallback?:PerBrowserOption<boolean>
Source: packages/wxt/src/types.ts:761
See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
Default
falseInherited from
BaseContentScriptEntrypointOptions.matchOriginAsFallback
noScriptStartedPostMessage?
optionalnoScriptStartedPostMessage?:boolean
Source: packages/wxt/src/types.ts:807
Do not send the wxt:content-script-started message via window.postMessage.
This has been replaced with custom events. The postMessage call is kept for backwards compatibility. For some websites the postMessage call is undesirable, such as those with poorly written message event listeners.
Setting this to true opts into the behavior that will become the default in a future version of WXT, where the postMessage call is removed entirely.
See https://github.com/wxt-dev/wxt/pull/1938 and https://github.com/wxt-dev/wxt/pull/2035 for a detailed discussion.
Inherited from
BaseContentScriptEntrypointOptions.noScriptStartedPostMessage
registration?
optionalregistration?:PerBrowserOption<"runtime"|"manifest">
Source: packages/wxt/src/types.ts:791
Specify how the content script is registered.
"manifest": The content script will be added to thecontent_scriptsentry in the manifest. This is the normal and most well known way of registering a content script."runtime": The content script'smatchesis added tohost_permissionsand you are responsible for using the scripting API to register/execute the content script dynamically at runtime.
Default
'manifest'Inherited from
BaseContentScriptEntrypointOptions.registration
runAt?
optionalrunAt?:PerBrowserOption<RunAt|undefined>
Source: packages/wxt/src/types.ts:723
See https://developer.chrome.com/docs/extensions/mv3/content_scripts/
Default
'documentIdle'Inherited from
BaseContentScriptEntrypointOptions.runAt
world
world:
"MAIN"
Source: packages/wxt/src/types.ts:815
See https://developer.chrome.com/docs/extensions/develop/concepts/content-scripts#isolated_world
Generated using typedoc-plugin-markdown and TypeDoc