Skip to content

Optimize auth.js: Replace defaultsDeep with Object.assign#1649

Closed
maslowivan wants to merge 2 commits intocommercetools:masterfrom
maslowivan:patch-1
Closed

Optimize auth.js: Replace defaultsDeep with Object.assign#1649
maslowivan wants to merge 2 commits intocommercetools:masterfrom
maslowivan:patch-1

Conversation

@maslowivan
Copy link
Contributor

Summary

defaultsDeep includes the lodash.defaultsdeep file what weight 51kb
we can use just Object.assign here

Todo

  • Tests
    • Unit
    • Integration
    • Acceptance
  • Documentation
  • Type label for the PR

defaultsDeep includes the lodash.defaultsdeep file what weight 51kb
we can use just Object.assign here
@maslowivan maslowivan changed the title Optimize auth.js Optimize auth.js: Replace defaultsDeep with Object.assign Jan 24, 2021
@maslowivan
Copy link
Contributor Author

maslowivan commented Jan 24, 2021

We can add the Object.assign as a polyfill for the old browsers but I think a lot of projects are already have this polyfill. However, the defaultsDeep requires to use the webpack alias hacking like:

Object.assign(config.resolve.alias, {
    // ...
    'lodash.defaultsdeep': path.join(__dirname, './library-hooks/lodash.defaultsdeep/index.js'),
  });
export default function defaultsDeep(a, b, c) {
  return Object.assign(a, b, c);
}

@maslowivan
Copy link
Contributor Author

Other option is to use the simple Object.create

@changeset-bot
Copy link

changeset-bot bot commented Jan 14, 2023

⚠️ No Changeset found

Latest commit: 3a4788e

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

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

@ajimae ajimae closed this Jan 17, 2023
@ajimae
Copy link
Member

ajimae commented Jan 17, 2023

This has been fixed here

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants