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

support reporting libraries that have the module entrypoint #45

Open
roopakv opened this issue Jul 3, 2020 · 3 comments
Open

support reporting libraries that have the module entrypoint #45

roopakv opened this issue Jul 3, 2020 · 3 comments
Labels
Hacktoberfest Hacktoberfest 2021

Comments

@roopakv
Copy link

roopakv commented Jul 3, 2020

While the presence of the module entrypoint automatically suggests the libraries don't have es5, it is helpful because of the following case:

We polyfill using core-js and the "usage" mechanism. If a module has the module entrypoint we need it to be transpiled so that it is polyfilled.

if are-you-es5 had an option to return libraries that have a module entrypoint we could use that to decide if they would be transpiled.

@obahareth
Copy link
Owner

obahareth commented Jul 23, 2020

Hey @roopakv, I'm really sorry for the late reply, I think something ate the notification on my side. We're completely relying on main instead of module at the moment but this is definitely something that should be supported. I'm not familiar with it and I'll do some reading, but quick question:
Have you ever found it to be the case where module and main are used together? If not then we can simply make the library load the module entrypoint if it exists or main otherwise and keep the rest of the code flowing normally and it should just work (unless there's something I dont' understand about module).

My Node.js/JavaScript usage has gone down a lot since I first wrote this library actually, so please forgive me if I've said anything that doesn't make any sense.

EDIT
Some quick reading shows that:

  • module is mostly used by bundlers like Webpack/Rollup and isn't "officially" part of the package.json spec yet?
  • If module is present the bundler will prefer to import as ES6 modules instead, which means they should be transpiled?

@obahareth
Copy link
Owner

@roopakv since it seems that bundlers always prefer to use the module entry point, what do you think of simply counting those packages as ES6 then? That should make them show up in the regex for transpilation.

My only concern is if there are bundlers that let you pick between main/module entry points somehow, is that something we have to worry about or are they always picking the module version?

@roopakv
Copy link
Author

roopakv commented Jul 26, 2020

@obahareth so webpaack allows you to pick which entry point to use. However as a start using module followed by main seems like a great start to me.

wdyt?

@obahareth obahareth added the Hacktoberfest Hacktoberfest 2021 label Sep 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Hacktoberfest Hacktoberfest 2021
Projects
None yet
Development

No branches or pull requests

2 participants