Skip to content

Different permissions based on manifest version? #172

Answered by aklinker1
max-arias asked this question in Q&A
Discussion options

You must be logged in to vote

The manifest option only accepts actual manifest schemas, so having a mv2 and mv3 fields won't do anything.

If you need to customize the manifest per build target, you should set it equal to a function to return the manifest depending on the manifest version of the build:

// wxt.config.ts
export default defineConfig({
  manifest: ({ manifestVersion }) => {
    const permissions = ["storage", "nativeMessaging"];
    if (manifestVersion === 2) permissions.push("*://*/*", "<all_urls>");
    else permissions.push("scripting");
    
    return {
      permissions,
    }, 
  },
}

I was going to link the config reference, but the type listed there is wrong... I'll get that fixed. Created #173 fo…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@maxarias-io
Comment options

Answer selected by aklinker1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants