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

Add support for ESM modules #105

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

eirslett
Copy link

Hey! Storybook uses this package as a dependency, and I noticed that it doesn't expose ESM modules - but it's quite easy to add support for. What do you think about this PR?

This generates ESM module syntax ("export default")
in a separate esm/ directory.

For simplicity, it assumes that if you want to use
ESM modules, you also have ES6 features in your
environment, so the build script turns that on as well.

The esm index.js is exposed through the "module" field
in package.json.

This generates ESM module syntax ("export default")
in a separate esm/ directory.

For simplicity, it assumes that if you want to use
ESM modules, you also have ES6 features in your
environment, so the build script turns that on as well.

The esm index.js is exposed through the "module" field
in package.json.
@coveralls
Copy link

Coverage Status

Coverage remained the same at 100.0% when pulling 937075b on eirslett:esm-modules into a8e7172 on epoberezkin:master.

@igloude
Copy link

igloude commented Jun 18, 2021

Would love to see some discussion/progress on this.

@jimmywarting
Copy link

The pkg size is starting to be questionable. Why should we need so many different versions and duplicate the code?
I think it should just switch from CJS to ESM, use native vanilla js syntax and require a higher NodeJS version

I'm not only looking for a fast deep-equal but also for a small footprint with faster download, faster CI pipeline and reduced number of files js performences isn't everything. Many are already using ESM, it requires no bundler and can be directly imported from both Deno and browsers - and also nodes new http loader - so no NPM is needed.

Think u should:

  • ditch dot and just write vanilla js
  • ditch reactjs specific build - circular ref should not be deep-equals problem... it's reactjs. if we should handle circular ref then it should be done in a generic way that isn't specific to react but to all circular references. Use a weakref and check if a object have already been compared.
  • ditch cjs build
  • ditch es6 build
  • ditch esm build
  • add "type": "module" in package.json
  • publish as a ESM only package

@valtism
Copy link

valtism commented Jan 11, 2022

Hey there 👋

Just wanted to bring up that the lack of esm support seems to be causing some downstream issues in libraries with the rise of build tools like Vite that are esm-only. I'm not sure if there is a workaround, but having esm output would help a lot here.

@btelles
Copy link

btelles commented Apr 29, 2022

Gentle ping?

@btakita
Copy link

btakita commented Aug 23, 2022

This is a small library, so it's easy to inline the function.

I made a esm version of the library @ctx-core/fast-deep-equal as well that suits my own needs, which are underscore case.

pubkey added a commit to pubkey/rxdb that referenced this pull request Jan 6, 2023
pubkey added a commit to pubkey/rxdb that referenced this pull request Jan 7, 2023
* ADD error on bailout

* REPLACE fast-deep-equal because of epoberezkin/fast-deep-equal#105

* REPLACE object-path

* UPDATE event-reduce
@mohdashraf010897
Copy link

@epoberezkin Any updates here?
Facing issues with Vite

@websitevirtuoso
Copy link

2 years gone. and problem still persist so sad

@btakita
Copy link

btakita commented Jul 8, 2023

I ended up forking this library to provide ESM support.
https://www.npmjs.com/package/@ctx-core/fast-deep-equal

pspaczek pushed a commit to infermedica/fast-deep-equal that referenced this pull request Aug 1, 2023
@NullVoxPopuli
Copy link

would the maintainers take a different PR?

@MrFiregore
Copy link

any news on 2024 or we will wait to 2025?

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.