Closed binarykitchen closed 6 years ago
Or have a main
entry in your package.json pointing to a plain JS file for distribution that has no const
@binarykitchen I would actually go to remove const
, if it's just that. Can you send a PR?
This was actually intentional. All modern browsers support const
(see also https://caniuse.com/#search=const) and it is possible to pin the version to 1.x in case someone needs a older support. So I am not that sure if we should really change that.
That being said, if someone babelifies for any reason we don't want a util that may be deep in a dep tree to break transpilation. If it's just const let's change it to var - it will cause the least friction
@BridgeAR yeah browsers support const
, although uglify complains.
looking at index.js, it's only 7 const
's to replace to make it work anywhere without the need to transpile, interpret anything. isn't that too much to ask?
For me it is not really about "too much to ask" but more about getting the ecosystem to move on. The less libraries are supported, the more others will have to catch up. I know it can be a pain though as user. Due to that I am fine with changing it.
ok, want a PR from me?
@binarykitchen PR would be welcome!
Because you use
const
in your source.Dont want to force global babelification due to bad performance.
Maybe can add this in your package.json?
See: https://github.com/babel/babelify#why-arent-files-in-node_modules-being-transformed