Optimize auth.js: Replace defaultsDeep with Object.assign#1649
Optimize auth.js: Replace defaultsDeep with Object.assign#1649maslowivan wants to merge 2 commits intocommercetools:masterfrom
Conversation
defaultsDeep includes the lodash.defaultsdeep file what weight 51kb we can use just Object.assign here
|
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);
} |
|
Other option is to use the simple Object.create |
|
|
This has been fixed here |
Summary
defaultsDeep includes the lodash.defaultsdeep file what weight 51kb
we can use just Object.assign here
Todo
Typelabel for the PR