Skip to content

Conversation

@jviney
Copy link

@jviney jviney commented Dec 24, 2025

Overview

Implements #2004

The IIFE name is not currently configurable for content scripts and unlisted scripts. The variable name can be important when inserting scripts with world=MAIN or directly via a <script> tag to ensure there is no conflict with an existing variable name on the page.

This PR is a followup to the discussion in #1897 where we decided to add a globalName option.

Questions:

  • The globalName property is available on all entrypoints - should we restrict this to just content scripts and unlisted scripts in the type definitions?
  • Is there any benefit to having the globalName option available for other entrypoint types?
  • How shall we indicate that the default value will switch to the behaviour of false in a future WXT version? Would this version change the generated output for other script types too (eg: background, popup), or will we leave them generating a named IIFE.

Manual Testing

Specify the globalName option on a content script or unlisted script entrypoint and check the generated JS output matches what's expected for the given option.

@netlify
Copy link

netlify bot commented Dec 24, 2025

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit 3ec531a
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/694bbcef1cabbb0008e235fd
😎 Deploy Preview https://deploy-preview-2017--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant