-
Notifications
You must be signed in to change notification settings - Fork 82
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
build: build with tsup and esbuild #2187
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
3e76ea2
to
f07e0be
Compare
f07e0be
to
aae7acb
Compare
aae7acb
to
e9c152b
Compare
size-limit report 📦
|
e9c152b
to
e68c358
Compare
e68c358
to
6547693
Compare
6547693
to
e746938
Compare
e746938
to
c67f143
Compare
@@ -1,31 +1,31 @@ | |||
export * from '@contentful/f36-collapse'; | |||
export * from '@contentful/f36-accordion'; |
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.
A - Z 😁
minify: true, | ||
platform: 'browser', | ||
sourcemap: true, | ||
target: 'es2016', |
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.
Maybe we can bump the target version to something newer, what do you think?
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 say we either use es6/es2015
- a kinda recommended standard for supporting most browsers, or we use any later version, but then there is no guarantee for support of all new es features in all modern browsers.
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.
Our official stance is we support the latest 2 major versions of a browser. Other than Safari, this gives us a very modern base.
https://www.contentful.com/faq/about-contentful/#which-browsers-does-contentful-support
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.
And consumers can always transpile the library themselves if they want to support something else.
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.
According to caniuse.com we can safely bump to es2020 – what do you think @bgutsol @massao ?
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.
ok 👍
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.
LGTM
c67f143
to
cfe572c
Compare
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.
NICE 🏅
This PR moves Forma 36 from Parcel to esbuild (through tsup)
Note that the size limit GitHub action check is NOT going to go green on this PR since the build output is different than our main branch.
Why?
Mainly because we've been having issues with Parcel. Circle CI has often been throwing segmentation faults during the build process lately, requiring us to restart failed builds all the time. esbuild is super fast but it doesn't output types and it's not going to.
Instead we use tsup which is a wrapper around esbuild that DOES let us build types. It's still really fast, although the type compilation slows us down a bunch. Without it this PR can build all our components in about 17 seconds on my machine ⚡
What we might need to discuss
tsup builds everything to
dist
directories. I've currently set it to build a CommonJS file todist/index.js
and an ESM file todist/index.mjs
. esbuild does not let us build UMD. In my opinion that's fine, except we currently provide it, so to avoid breaking changes this PR still uses Microbundle to build the@contentful/f36-components
package, which has the following output:index.js
– CommonJSindex.modern.mjs
– Uses Microbundle's "Modern mode" which means it transpiles ESM with Babels – actually really cool 👍index.mjs
– ESMindex.umd.js
– UMDIt would be good to drop UMD support when we can.