-
Notifications
You must be signed in to change notification settings - Fork 361
chore: convert bublé to babel for es2015 compilation #362
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
Conversation
40d345d
to
dcd4f4f
Compare
wondering how this fares against the size diffs shown in #263 |
We might have to introduce a script that compares file size diffs of the tests on master versus PR that might ease this process up a bit. |
yeah, something like bundlesize might help here. Most files look similar but I still need to do a proper check, also tests are super slow on my machine so need to check that as well. |
It seems to take long due to circular dependencies in core-js. Also the size diffs stay the same as the previous PR and the esnext-ts lib is not compiling.
Here's a script you can use to see the sizes, remove the |
ae7c136
to
91a4f5b
Compare
91a4f5b
to
90ce17b
Compare
2f51304
to
5ece2b3
Compare
So I think this PR is ready to go. (I need to update the sizes table) Babel flow & typescript will probably be for the next PR as typescript babel plugin doesn't emit definitions so we'll have to run the compiler ourselves which I guess is better for another PR. |
I don't mind making the TypeScript PR, do you want it to point towards this PR or get this to master first? |
Get this in master first I would say |
// transpile down `async/await`. To prevent conflicts with user | ||
// supplied configurations we set this option to false. Note | ||
// that we never supported using custom babel configs anyway. | ||
babelrc: false, |
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.
so if someone has a babelrc in their project dir it now gets included?
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.
Yes, it's actually intentional. I'll add a few tests for it.
This way people can add babel-plugin-macros and other plugins. So it will work with every codebase. I like microbundle so I don't have to configure rollup and such but would love babel configuration. We could put it under an option and warn people.
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.
If you add a .babelrc
that would overwrite the default config right? In that case it would be nice to have a way to just extend the default config so you don't need to add preset-env
again etc.
Next.js solves this in a neat way imo. And in our case it could look something like this
// .babelrc
{
"presets": "microbundle/babel",
"plugins": [
// my custom plugins
]
}
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.
yeah that would be ideal
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.
Looks good, extendable babel config could possibly be an additional pr
@ForsakenHarmony should I disable babelrc for now until extendable config is fixed? Do we need more discussion on allowing babelrc? should I add a few tests to make sure babelrc works? (probably a good idea, just to make sure it works) |
I think we definitely want to be able to extend/override it If you want to add some more tests here that would be good too |
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 🎉
95ebf52
to
3483790
Compare
I added a test for babelrc to accept a stage-2 feature. I also tried to override babel-preset-env but that wasn't possible, so that's actually good as people won't be able to remove presets we set. i'll work on a follow up to fix this so we can still add a few performance plugins like async-to-promise Latest size report from travis: |
bors r+ |
362: chore: convert bublé to babel for es2015 compilation r=ForsakenHarmony a=wardpeet Remove bublé and use babel instead. This gives us the opportunity to easily move to modern builds. The file sizes are all kept almost the same. The sizes are raw bytes which means gzip and brotli isn't used so the diff is going to be minimal. I also added 2 scripts so we can generate these tables easier Latest size report from travis: https://travis-ci.org/developit/microbundle/builds/537119810#L330-L380 <details> <summary>File sizes</summary> | file | bublé | babel | |------------------------------------------------|---------|----------| | alias/alias-mapping.js | 42 | 42 | | alias/alias-mapping.mjs | 42 | 42 | | alias/alias-mapping.umd.js | 121 | 121 | | async-iife-ts/async-iife-ts.js | 116 | 116 | | async-iife-ts/async-iife-ts.mjs | 117 | 117 | | async-iife-ts/async-iife-ts.umd.js | 199 | 199 | | async-iife-ts/index.d.ts | 0 | 0 | | async-ts/async-ts.js | **104** | 120 | | async-ts/async-ts.mjs | **108** | 132 | | async-ts/async-ts.umd.js | **287** | 303 | | async-ts/index.d.ts | 62 | 62 | | basic/basic-lib.js | **468** | 502 | | basic/basic-lib.mjs | **468** | 502 | | basic/basic-lib.umd.js | **643** | 677 | | basic-css/basic-css.css | 48 | 48 | | basic-css/basic-css.js | 133 | 133 | | basic-css/basic-css.mjs | 133 | 133 | | basic-css/basic-css.umd.js | 308 | 308 | | basic-json/basic-json.js | 168 | **113** | | basic-json/basic-json.mjs | 168 | **113** | | basic-json/basic-json.umd.js | 344 | **289** | | basic-multi-source/a.js | 53 | 53 | | basic-multi-source/a.mjs | 54 | 54 | | basic-multi-source/a.umd.js | 136 | 136 | | basic-multi-source/b.js | 53 | 53 | | basic-multi-source/b.mjs | 54 | 54 | | basic-multi-source/b.umd.js | 136 | 136 | | basic-ts/basic-lib-ts.js | **130** | 147 | | basic-ts/basic-lib-ts.mjs | **123** | 140 | | basic-ts/basic-lib-ts.umd.js | **299** | 316 | | basic-ts/car.d.ts | 163 | 163 | | basic-ts/index.d.ts | 78 | 78 | | basic-tsx/basic-lib-tsx.js | **304** | 344 | | basic-tsx/basic-lib-tsx.mjs | **305** | 346 | | basic-tsx/basic-lib-tsx.umd.js | **482** | 522 | | basic-tsx/index.d.ts | 51 | 51 | | basic-with-cwd/basic.js | **464** | 498 | | basic-with-cwd/basic.mjs | **464** | 498 | | basic-with-cwd/basic.umd.js | **636** | 670 | | class-decorators-ts/class-decorators-ts.js | 591 | 591 | | class-decorators-ts/class-decorators-ts.mjs | 588 | 588 | | class-decorators-ts/class-decorators-ts.umd.js | 771 | 771 | | class-decorators-ts/index.d.ts | 168 | 168 | | class-properties/class-properties.js | 127 | 127 | | class-properties/class-properties.mjs | 122 | 122 | | class-properties/class-properties.umd.js | 312 | 312 | | custom-source/custom-source.js | **472** | 506 | | custom-source/custom-source.mjs | **472** | 506 | | custom-source/custom-source.umd.js | **651** | 685 | | custom-source-with-cwd/custom-src.js | **469** | 503 | | custom-source-with-cwd/custom-src.mjs | **469** | 503 | | custom-source-with-cwd/custom-src.umd.js | **645** | 679 | | default-named/default-named.js | 87 | 87 | | default-named/default-named.mjs | 97 | 97 | | default-named/default-named.umd.js | 269 | 269 | | define/define.js | 35 | 35 | | define/define.mjs | 35 | 35 | | define/define.umd.js | 114 | 114 | | esnext-ts/esnext-ts.js | 2095 | **1997** | | esnext-ts/esnext-ts.mjs | 2096 | **1998** | | esnext-ts/esnext-ts.umd.js | 2270 | **2172** | | esnext-ts/index.d.ts | 48 | 48 | | jsx/jsx.js | **365** | 405 | | jsx/jsx.mjs | **366** | 407 | | jsx/jsx.umd.js | **535** | 575 | | name-custom-amd/name-custom-amd.js | **474** | 508 | | name-custom-amd/name-custom-amd.mjs | **474** | 508 | | name-custom-amd/name-custom-amd.umd.js | **654** | 688 | | name-custom-cli/name-custom.js | **470** | 504 | | name-custom-cli/name-custom.mjs | **470** | 504 | | name-custom-cli/name-custom.umd.js | **650** | 684 | | no-pkg/no-pkg.js | **465** | 499 | | no-pkg/no-pkg.mjs | **465** | 499 | | no-pkg/no-pkg.umd.js | **637** | 671 | | no-pkg-name/no-pkg-name.js | **470** | 504 | | no-pkg-name/no-pkg-name.mjs | **470** | 504 | | no-pkg-name/no-pkg-name.umd.js | **646** | 680 | | pretty/pretty.js | 12522 | 12522 | | pretty/pretty.mjs | 12534 | 12534 | | pretty/pretty.umd.js | 12704 | 12704 | | raw/raw.js | 2960 | 2960 | | raw/raw.mjs | 2972 | 2972 | | raw/raw.umd.js | 3139 | 3139 | | shebang/shebang.js | 101 | 101 | | shebang/shebang.mjs | 108 | 108 | | shebang/shebang.umd.js | 284 | 284 | | ts-mixed-exports/car.d.ts | 163 | 163 | | ts-mixed-exports/index.d.ts | 95 | 95 | | ts-mixed-exports/ts-mixed-exports.js | **149** | 169 | | ts-mixed-exports/ts-mixed-exports.mjs | **144** | 168 | | ts-mixed-exports/ts-mixed-exports.umd.js | **333** | 353 | </details> Co-authored-by: Ward Peeters <[email protected]>
Build succeeded |
Changed because this project no longer utilises Bublé, it was replaced with Babel in developit/microbundle#362.
Remove bublé and use babel instead. This gives us the opportunity to easily move to modern builds. The file sizes are all kept almost the same. The sizes are raw bytes which means gzip and brotli isn't used so the diff is going to be minimal.
I also added 2 scripts so we can generate these tables easier
Latest size report from travis:
https://travis-ci.org/developit/microbundle/builds/537119810#L330-L380
File sizes