Skip to content

Conversation

mgfalzon
Copy link

@mgfalzon mgfalzon commented Jun 5, 2025

Motivation

This change decreases the JS output for Confluence by 366kb. For large applications the bytes add up quick!

Other smaller optimizations to consider:

  • Replacing other helper function calls with arrow function
  • Changing parcelRequire.register to parcelRequire.r
  • Reducing the size of parcelRequireName, the current definition for confluence is parcelRequired477 which shows up in 3721 files in Conflunece. Reducing it to rd477 would save 44kb.

Changes

  • Use arrow functions in parcelRegister calls
  • Reduce calls to this.bundle.env.supports('arrow-functions', true);

Checklist

  • Existing or new tests cover this change
  • There is a changeset for this change, or one is not required

Copy link

changeset-bot bot commented Jun 5, 2025

🦋 Changeset detected

Latest commit: f6ee6cb

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@atlaspack/packager-js Minor
@atlaspack/config-default Patch
@atlaspack/config-repl Patch
@atlaspack/config-webextension Patch
@atlaspack/cli Patch
@atlaspack/register Patch
@atlaspack/test-utils Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@mgfalzon mgfalzon changed the title Improve arrow function support PCC-5240 Improve arrow function support Jun 5, 2025
@mgfalzon mgfalzon changed the title PCC-5240 Improve arrow function support Improve arrow function support Jun 5, 2025
Copy link
Contributor

@yamadapc yamadapc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM but you should feature-flag it

@marcins
Copy link
Contributor

marcins commented Jun 11, 2025

The factory function is called with this bound to module.exports.. can we guarantee that none of the code we have assumes that this is equal to exports for it to function? (Less so "our" code, more third party deps in node_modules that may be built in weird and wonderful ways..)

I have some vague recollection we ran into one third party dep that broke due to this in Jira - because if I remember correctly we did have this change in PR at some point in the past.

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.

3 participants