Skip to content

build: Use an IIFE where possible#88

Merged
NotNite merged 2 commits into
developfrom
notnite/iife
Oct 8, 2024
Merged

build: Use an IIFE where possible#88
NotNite merged 2 commits into
developfrom
notnite/iife

Conversation

@NotNite
Copy link
Copy Markdown
Member

@NotNite NotNite commented Oct 8, 2024

We weren't wrapping things in an IIFE so global scope was being ruined by various dependencies (e.g. window was full of minified variable names lol). This PR fixes this by wrapping everything in an IIFE and telling esbuild to assign it to global variable module.exports to fix the exports. This results in this very funny build output:

"use strict";
var module;
(module ||= {}).exports = (() => {
  // ...
})();

Should be ready to merge, I just want to test this heavily as it could break everything. This will also need to be brought over to the sample extension build script.

@NotNite NotNite self-assigned this Oct 8, 2024
@NotNite NotNite marked this pull request as ready for review October 8, 2024 14:10
@NotNite
Copy link
Copy Markdown
Member Author

NotNite commented Oct 8, 2024

Tested and it seems to be OK. If shit breaks it's my fault. :p

@NotNite NotNite merged commit 8ebc44b into develop Oct 8, 2024
@redstonekasi redstonekasi deleted the notnite/iife branch January 12, 2025 22:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

1 participant