Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Export a "default" property #325

Merged
merged 2 commits into from
Sep 10, 2024
Merged

Conversation

felixrieseberg
Copy link
Member

Fixes #323

Older versions of @electron/asar exported all its functions at the top-level. TypeScript would take our old module, and if someone (like @electron/forge) ran import asar from "@electron/asar", execute the following code:

var asar = __importDefault(require("@electron/asar"))

var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};

// later, in our @electron/forge code:
await asar_1.default.createPackageWithOptions(...)

In our old version, that would result in:

asar = {
  default: {
     [... all our methods]
  }
}

Now, we're setting __esModule: true, so TypeScript will just return:

asar = {
  default: undefined 
}

And therefore, all code that looks like

await asar_1.default.createPackageWithOptions(...)

crashes, because default is now undefined.

@felixrieseberg felixrieseberg requested a review from a team as a code owner September 10, 2024 23:51
@felixrieseberg felixrieseberg merged commit 06312cd into main Sep 10, 2024
3 checks passed
@felixrieseberg felixrieseberg deleted the felixr-default-export branch September 10, 2024 23:58
Copy link

🎉 This PR is included in version 3.2.12 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Latest version crash my build pipeline
4 participants