Skip to content

Commit e6f8d68

Browse files
committed
add suppressWarnings config option
1 parent 2cc2385 commit e6f8d68

File tree

4 files changed

+31
-3
lines changed

4 files changed

+31
-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?.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: true` 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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,22 @@ 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: {
141+
* firefoxDataCollection: true,
142+
* },
143+
* })
144+
* ```
145+
*/
146+
suppressWarnings?: { firefoxDataCollection?: boolean } & Record<
147+
string,
148+
boolean
149+
>;
134150
/**
135151
* Configure browser startup. Options set here can be overridden in a `web-ext.config.ts` file.
136152
*/
@@ -1393,6 +1409,13 @@ export interface ResolvedConfig {
13931409
*/
13941410
alias: Record<string, string>;
13951411
experimental: {};
1412+
/**
1413+
* List of warning identifiers to suppress during the build process.
1414+
*/
1415+
suppressWarnings: { firefoxDataCollection?: boolean } & Record<
1416+
string,
1417+
boolean
1418+
>;
13961419
dev: {
13971420
/** Only defined during dev command */
13981421
server?: {

0 commit comments

Comments
 (0)