-
-
Notifications
You must be signed in to change notification settings - Fork 363
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
Include a UMD build #44
Comments
run into the same problem when using ssr. |
quick fix
And the module.exports = {
presets: [
[
'@babel/preset-env',
{
loose: true,
targets: {
node: true,
},
},
],
],
}; |
Seems to have been intentional: #23 But FWIW this is a confusing decision. Requiring a |
I agree with all of those points. I feel like the only thing "standard" about modules is that TC39 stopped arguing about them. Of course, it's worth noting... The README specifically states:
So, if you want to be pedantic, this warning was theoretically given. Technically, all of those browsers "support" modules now. Of course, they do it in a variety of ways, and in my opinion you'd be a raving lunatic to try and use them without the comfort and safety of Babel. I think someone (who isn't me) could also make the argument that all packages on npm should be the most modern possible syntax and the end user is responsible for transpiling "backwards". As in, you should "opt in" to supporting legacy environments (and Node). |
Per semver, minor bumps in pre-1.0.0 versions are to be considered like major bumps. That's also why |
Yes, that would be me. |
The problem is that there's no standard way to expose both a file with modern syntax and ES5 syntax. The common pattern is See: https://babeljs.io/blog/2018/06/26/on-consuming-and-publishing-es2015+-packages Would having a |
+1 to keeping ES6 as the first-class entrypoint to encourage progress, and also providing a 'legacy' entrypoint like As for what the Babel |
👍 |
Alright. PR welcome to add the Babel config. The config should be in package.json. |
Off topic, just curious, why do you prefer it to be in package.json? |
I prefer to keep all config in one file whenever possible. |
I realize now that "modern syntax" was maybe the wrong thing for me to have said, since that's a pretty flexible definition. Do you have any rules in mind for what syntax should be encouraged/supported? Only things ratified into the actual language specification, or is anything shipped by a browser vendor safe? As background, I think I had the same use case as @rifler - I wasn't trying to use ky in Node, but I have a SSR React application that bails out in Node due to the And, for my part, I think it's totally reasonable to not support old browsers (or Node). I - and probably a lot of other people - take it for granted that everything in npm is conventionally minified ES5, but the more I think about it... There's no reason that needs to be the case anymore. I think the addition of the es5 version is a good compromise, but it feels selfish in retrospect. 😄 Kinda off-topic: I'd love to see some kind of beautiful union of ky and got in the future, too. I bet I could get 90% of the way there with ky and |
For another point, what about using the Webpack for a min file? Like this? const path = require('path');
module.exports = {
mode: 'production',
entry: path.join(__dirname, 'index.js'),
output: {
path: path.join(__dirname, 'dist'),
filename: 'ky.min.js',
library: 'ky',
libraryExport: 'default'
}
}; |
@LitoMore No, that's too much. |
I'm using
I also had to install this packages for this to work:
|
#46 was closed for lack of activity. The required work is documented in #46 (comment). |
I'm having to transpile the module before usage and I'm not sure if that's intentional.
This is the line which caused me pain.
ky/index.js
Line 192 in eb4b341
Feel free to close this is if the use of export is intentional, I couldn't really tell from the docs.
The text was updated successfully, but these errors were encountered: