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

feat: remove lodash #35

Merged
merged 1 commit into from
Mar 3, 2021
Merged

feat: remove lodash #35

merged 1 commit into from
Mar 3, 2021

Conversation

jquense
Copy link
Member

@jquense jquense commented Jul 10, 2020

closes #34 Hows this look @TrySound ?

@TrySound
Copy link
Contributor

@jquense
Copy link
Member Author

jquense commented Jul 10, 2020

would that matter here? there is nothing to tree shake

@TrySound
Copy link
Contributor

There is more to process for rollup users. For example I keep "include" list for all commonjs dependencies to speed up build and reduce memory usage.

@TrySound
Copy link
Contributor

Also webpack 4 wraps every commonjs module with function which prevents its scope hoisting.

@Twipped
Copy link

Twipped commented Dec 31, 2020

You could also just do it the way React does it:

function areHookInputsEqual (nextDeps, prevDeps) {
  const is = Object.is || ((x, y) => (x === y && (x !== 0 || 1 / x === 1 / y)) || (x !== x && y !== y)); // eslint-disable-line no-self-compare

  if (prevDeps === null) {
    return false;
  }

  for (let i = 0; i < prevDeps.length && i < nextDeps.length; i++) {
    if (!is(nextDeps[i], prevDeps[i])) return false;
  }
  return true;
}

See https://github.com/facebook/react/blob/master/packages/react-reconciler/src/ReactFiberHooks.new.js#L286

@jquense jquense merged commit fefa63c into master Mar 3, 2021
@jquense jquense deleted the fast-compare branch March 3, 2021 21:04
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.

Remove lodash dependency
3 participants