-
Notifications
You must be signed in to change notification settings - Fork 13
Conversation
rollup.config.js
Outdated
typescript({ | ||
typescript: require('typescript'), | ||
}), | ||
babel({ extensions, include: ['src/**/*'], exclude: 'node_modules/**' }), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The output that will come out is ES6 and won't be compatible some browsers (IE11 edge,...) this because tsconfig has ES2015 target and babel config has current node. bsconfig also seems to target ES6.
next-urql works correctly since it just passed in
@babel/env
without any options so it compiles down to the lowest target
If we're not planning on any custom transformations I'd say this is actually a pretty good case for microbundle usage can be seen here
They've stopped using bublé under the hood and transitioned to babel to support modern presets now as well (serve a modern bundle for a modern browser)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch! I didn't even notice that, but in looking at the non-minified build output now there definitely is some ES6 in there 😅 🆒 I'll give microbundle
a shot!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it’s also worth just copying what we have for urql and combining it with what we have in Wonka (it already looks pretty similar)
Happy to send some commits over for that!
Basically, we use TypeScript to compile to certain helpers but not much, we then use Buble because it handles classes and spreading/rest operators the best, lastly we use Babel only for the “detail” work, like making sure that we have a unified helper for Object.assign
We also recently added closure-compiler
but that can mangle code which may not be a good choice for renature.
We also make sure that our Rollup configs are always self-sufficient. So we define all configs in there on their own, and don’t rely on external Babel configs, etc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd love to have you send over some commits if you have the time! I did manage to get microbundle
working with pretty minimal effort, but I'd like to see what you have in mind. Agreed that I don't think it's quite worth getting full closure compiler stuff in just yet, but everything else sounds good 😄
Also FYI you may hit some TS errors when compiling. I got around them just now, but did find an issue with genType
where it'll sometimes generate unused generics 😬 All of the fixes can be found in this commit: 85a0c9a
This PR adds rollup to build
renature
for distribution on npm 🎉 I mostly just copied my configuration fromnext-urql
since that's worked pretty well for me. That version is based off ofurql
'srollup
config minus all thebuble
stuff. When we really want to shave more bytes we can bring inbuble
.Any feedback is welcome! I haven't yet tested this, but will locally by symlinking a little sandbox app. Once we get that verified and get Travis in, I think we can release v0.1.0-rc.0. I'm going to use rc's on this project as a way of getting features out quick without needing to contemplate semver challenges for every tiny thing.
@kitten and @JoviDeCroock tagging you b/c you seem to have a knack for shaving bytes 😉