are-you-es5
are-you-es5 copied to clipboard
support reporting libraries that have the module entrypoint
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.
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?
@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?
@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?