Skip to content

Commit 12da160

Browse files
committed
add suppressWarnings config option
1 parent d933d25 commit 12da160

File tree

4 files changed

+23
-3
lines changed

4 files changed

+23
-3
lines changed

packages/wxt/src/core/resolve-config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ export async function resolveConfig(
226226
userConfigMetadata: userConfigMetadata ?? {},
227227
alias,
228228
experimental: defu(mergedConfig.experimental, {}),
229+
suppressWarnings: mergedConfig.suppressWarnings ?? [],
229230
dev: {
230231
server: devServerConfig,
231232
reloadCommand,

packages/wxt/src/core/utils/manifest.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -121,11 +121,14 @@ export async function generateManifest(
121121
// Warn if building for Firefox without data_collection_permissions
122122
if (
123123
wxt.config.browser === 'firefox' &&
124-
!userManifest.browser_specific_settings?.gecko?.data_collection_permissions
124+
!userManifest.browser_specific_settings?.gecko
125+
?.data_collection_permissions &&
126+
!wxt.config.suppressWarnings.includes('firefoxDataCollection')
125127
) {
126128
wxt.logger.warn(
127-
'Firefox requires explicit data collection permissions. Consider adding `data_collection_permissions` to your manifest config.\n' +
128-
'For more details, see: https://extensionworkshop.com/documentation/develop/firefox-builtin-data-consent/\n',
129+
'Firefox requires `data_collection_permissions` for new extensions from November 3, 2025. Existing extensions are exempt for now.\n' +
130+
'For more details, see: https://extensionworkshop.com/documentation/develop/firefox-builtin-data-consent/\n' +
131+
'To suppress this warning, add `firefoxDataCollection` to `suppressWarnings` in your wxt config.\n',
129132
);
130133
}
131134

packages/wxt/src/core/utils/testing/fake-objects.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -305,6 +305,7 @@ export const fakeResolvedConfig = fakeObjectCreator<ResolvedConfig>(() => {
305305
hooks: {},
306306
vite: () => ({}),
307307
plugins: [],
308+
suppressWarnings: [],
308309
};
309310
});
310311

packages/wxt/src/types.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,17 @@ export interface InlineConfig {
131131
* object or promise.
132132
*/
133133
manifest?: UserManifest | Promise<UserManifest> | UserManifestFn;
134+
/**
135+
* Suppress specific warnings during the build process.
136+
*
137+
* @example
138+
* ```ts
139+
* export default defineConfig({
140+
* suppressWarnings: ['firefoxDataCollection'],
141+
* })
142+
* ```
143+
*/
144+
suppressWarnings?: string[];
134145
/**
135146
* Configure browser startup. Options set here can be overridden in a `web-ext.config.ts` file.
136147
*/
@@ -1393,6 +1404,10 @@ export interface ResolvedConfig {
13931404
*/
13941405
alias: Record<string, string>;
13951406
experimental: {};
1407+
/**
1408+
* List of warning identifiers to suppress during the build process.
1409+
*/
1410+
suppressWarnings: string[];
13961411
dev: {
13971412
/** Only defined during dev command */
13981413
server?: {

0 commit comments

Comments
 (0)