Skip to content
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

feat(build): Transpile assuming higher version of runtime #9511

Merged
merged 7 commits into from Jan 20, 2020

Conversation

eps1lon
Copy link
Member

@eps1lon eps1lon commented Nov 25, 2019

We saw up to 3% reduction for our landing page and app bundle with next 8: mui/material-ui#18512 (comment)

Option isn't documented yet but documentation is requested by a babel maintainer (babel/website#2055). Documentation PR is filed in babel/website#2134

@timneutkens
Copy link
Member

@developit can you review.

@@ -157,6 +157,8 @@ module.exports = (
helpers: true,
regenerator: true,
useESModules: supportsESM && presetEnvConfig.modules !== 'commonjs',
// the lower of the entries in package.json for `@babel/rutime` and `@babel/runtime-corejs2`
version: '7.7.2',
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading this from the current package.json is probably smarter. I don't know how your deployed file layout looks like or if you already have functionality for this. If you can give directions I'll happily improve this.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

require('@babel/runtime/package.json').version

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's perfect. It even works with overriding the @babel/runtime version via resolutions.

@ijjk
Copy link
Member

ijjk commented Nov 25, 2019

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
buildDuration 13.9s 14.2s ⚠️ +338ms
nodeModulesSize 48.3 MB 48.3 MB ⚠️ +240 B
Client Bundles (main, webpack, commons)
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
main-HASH.js 17.9 kB 17.9 kB
main-HASH.js gzip 6.33 kB 6.33 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
16b1a7225520..ebc17c08d.js 19.8 kB 19.8 kB
16b1a7225520..c08d.js gzip 7.35 kB 7.35 kB
4952ddcd88e7..49d7903c2.js 9.6 kB 9.6 kB
4952ddcd88e7..03c2.js gzip 3.76 kB 3.76 kB
commons.HASH.js 10.4 kB 10.4 kB
commons.HASH.js gzip 3.91 kB 3.91 kB
de003c3a9d30..a824c82eb.js 28.3 kB 28.3 kB
de003c3a9d30..82eb.js gzip 10.7 kB 10.7 kB
framework.HASH.js 125 kB 125 kB
framework.HASH.js gzip 39.4 kB 39.4 kB
Overall change 213 kB 213 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
main-HASH.module.js 14.1 kB 14.1 kB
main-HASH.module.js gzip 5.3 kB 5.3 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
16b1a7225520..9a.module.js 21.3 kB 21.3 kB
16b1a7225520..dule.js gzip 8.14 kB 8.14 kB
4952ddcd88e7..cc.module.js 11.9 kB 11.9 kB
4952ddcd88e7..dule.js gzip 4.43 kB 4.43 kB
de003c3a9d30..36.module.js 22.2 kB 22.2 kB
de003c3a9d30..dule.js gzip 8.71 kB 8.71 kB
framework.HASH.module.js 125 kB 125 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
Overall change 196 kB 196 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
polyfills-HASH.js 9.11 kB 9.11 kB
polyfills-HASH.js gzip 3.11 kB 3.11 kB
Overall change 9.11 kB 9.11 kB
Client Pages
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_app.js 2.92 kB 2.92 kB
_app.js gzip 1.32 kB 1.32 kB
_error.js 13.2 kB 13.2 kB
_error.js gzip 5.1 kB 5.1 kB
hooks.js 1.92 kB 1.92 kB
hooks.js gzip 941 B 941 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.76 kB 6.76 kB
link.js gzip 2.88 kB 2.88 kB
routerDirect.js 413 B 413 B
routerDirect.js gzip 285 B 285 B
withRouter.js 423 B 423 B
withRouter.js gzip 284 B 284 B
Overall change 26 kB 26 kB
Client Pages Modern
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_app.module.js 1.54 kB 1.54 kB
_app.module.js gzip 759 B 759 B
_error.module.js 10.5 kB 10.5 kB
_error.module.js gzip 4.26 kB 4.26 kB
hooks.module.js 677 B 677 B
hooks.module.js gzip 384 B 384 B
index.module.js 292 B 292 B
index.module.js gzip 223 B 223 B
link.module.js 5.49 kB 5.49 kB
link.module.js gzip 2.47 kB 2.47 kB
routerDirect.module.js 399 B 399 B
routerDirect..dule.js gzip 285 B 285 B
withRouter.module.js 409 B 409 B
withRouter.m..dule.js gzip 282 B 282 B
Overall change 19.3 kB 19.3 kB
Client Build Manifests
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_buildManifest.js 244 B 244 B
_buildManifest.js gzip 201 B 201 B
_buildManifest.module.js 251 B 251 B
_buildManife..dule.js gzip 208 B 208 B
Overall change 495 B 495 B
Rendered Page Sizes
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
index.html 4.06 kB 4.06 kB
index.html gzip 1.04 kB 1.04 kB
link.html 4.58 kB 4.58 kB
link.html gzip 1.12 kB 1.12 kB
withRouter.html 4.59 kB 4.59 kB
withRouter.html gzip 1.1 kB 1.1 kB
Overall change 13.2 kB 13.2 kB

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
buildDuration 14.6s 14.4s -195ms
nodeModulesSize 48.3 MB 48.3 MB ⚠️ +240 B
Client Bundles (main, webpack, commons)
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
main-HASH.js 17.9 kB 17.9 kB
main-HASH.js gzip 6.33 kB 6.33 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
16b1a7225520..ebc17c08d.js 19.8 kB 19.8 kB
16b1a7225520..c08d.js gzip 7.35 kB 7.35 kB
4952ddcd88e7..49d7903c2.js 9.6 kB 9.6 kB
4952ddcd88e7..03c2.js gzip 3.76 kB 3.76 kB
commons.HASH.js 10.4 kB 10.4 kB
commons.HASH.js gzip 3.91 kB 3.91 kB
de003c3a9d30..a824c82eb.js 28.3 kB 28.3 kB
de003c3a9d30..82eb.js gzip 10.7 kB 10.7 kB
framework.HASH.js 125 kB 125 kB
framework.HASH.js gzip 39.4 kB 39.4 kB
Overall change 213 kB 213 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
main-HASH.module.js 14.1 kB 14.1 kB
main-HASH.module.js gzip 5.3 kB 5.3 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
16b1a7225520..9a.module.js 21.3 kB 21.3 kB
16b1a7225520..dule.js gzip 8.14 kB 8.14 kB
4952ddcd88e7..cc.module.js 11.9 kB 11.9 kB
4952ddcd88e7..dule.js gzip 4.43 kB 4.43 kB
de003c3a9d30..36.module.js 22.2 kB 22.2 kB
de003c3a9d30..dule.js gzip 8.71 kB 8.71 kB
framework.HASH.module.js 125 kB 125 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
Overall change 196 kB 196 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
polyfills-HASH.js 9.11 kB 9.11 kB
polyfills-HASH.js gzip 3.11 kB 3.11 kB
Overall change 9.11 kB 9.11 kB
Client Pages
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_app.js 2.92 kB 2.92 kB
_app.js gzip 1.32 kB 1.32 kB
_error.js 13.2 kB 13.2 kB
_error.js gzip 5.1 kB 5.1 kB
hooks.js 1.92 kB 1.92 kB
hooks.js gzip 941 B 941 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.76 kB 6.76 kB
link.js gzip 2.88 kB 2.88 kB
routerDirect.js 413 B 413 B
routerDirect.js gzip 285 B 285 B
withRouter.js 423 B 423 B
withRouter.js gzip 284 B 284 B
Overall change 26 kB 26 kB
Client Pages Modern
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_app.module.js 1.54 kB 1.54 kB
_app.module.js gzip 759 B 759 B
_error.module.js 10.5 kB 10.5 kB
_error.module.js gzip 4.26 kB 4.26 kB
hooks.module.js 677 B 677 B
hooks.module.js gzip 384 B 384 B
index.module.js 292 B 292 B
index.module.js gzip 223 B 223 B
link.module.js 5.49 kB 5.49 kB
link.module.js gzip 2.47 kB 2.47 kB
routerDirect.module.js 399 B 399 B
routerDirect..dule.js gzip 285 B 285 B
withRouter.module.js 409 B 409 B
withRouter.m..dule.js gzip 282 B 282 B
Overall change 19.3 kB 19.3 kB
Client Build Manifests
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_buildManifest.js 244 B 244 B
_buildManifest.js gzip 201 B 201 B
_buildManifest.module.js 251 B 251 B
_buildManife..dule.js gzip 208 B 208 B
Overall change 495 B 495 B
Serverless bundles
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_error.js 255 kB 255 kB
_error.js gzip 67.9 kB 67.9 kB
hooks.html 4.19 kB 4.19 kB
hooks.html gzip 1.07 kB 1.07 kB
index.js 256 kB 256 kB
index.js gzip 68 kB 68 kB
link.js 288 kB 288 kB
link.js gzip 77.1 kB 77.1 kB
routerDirect.js 281 kB 281 kB
routerDirect.js gzip 75.1 kB 75.1 kB
withRouter.js 281 kB 281 kB
withRouter.js gzip 75.2 kB 75.2 kB
Overall change 1.37 MB 1.37 MB

Commit: d23da80

@eps1lon
Copy link
Member Author

eps1lon commented Nov 25, 2019

Not sure why no reduction is reported. We use runtime-corejs2@7.7.4 while 7.7.2 is used here. In addition we specified ^7.7.4 in version over an exact 7.4.2.

Copy link
Member

@Timer Timer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not specifying a version is actually pretty optimal here.

The only benefit gained is polyfilling more, which would mean a increase in bundle size. I'm not sure why you're seeing a decrease.

The only things not polyfilled are the Math modules, though that might be OK to allow.

@merceyz
Copy link
Contributor

merceyz commented Nov 26, 2019

I'm not sure why you're seeing a decrease.

More helpers can be imported from newer versions of @babel/runtime instead of duplicating them in all files that needs them

babel/babel#10261 (comment)

@eps1lon eps1lon force-pushed the feat/transform-runtime-version branch from d23da80 to e6375e4 Compare December 9, 2019 12:18
@ijjk
Copy link
Member

ijjk commented Dec 9, 2019

Stats from current PR

Default Server Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
buildDuration 15.3s 15.2s -92ms
nodeModulesSize 46.8 MB 46.8 MB ⚠️ +138 B
Client Bundles (main, webpack, commons)
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
main-HASH.js 18.3 kB 18.3 kB
main-HASH.js gzip 6.44 kB 6.44 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
16b1a7225520..10012f496.js 20 kB 20 kB
16b1a7225520..f496.js gzip 7.42 kB 7.42 kB
4952ddcd88e7..49d7903c2.js 9.61 kB 9.61 kB
4952ddcd88e7..03c2.js gzip 3.77 kB 3.77 kB
commons.HASH.js 10.4 kB 10.4 kB
commons.HASH.js gzip 3.91 kB 3.91 kB
de003c3a9d30..a5a0ede39.js 21.2 kB 21.2 kB
de003c3a9d30..de39.js gzip 8.19 kB 8.19 kB
framework.HASH.js 126 kB 126 kB
framework.HASH.js gzip 39.5 kB 39.5 kB
Overall change 207 kB 207 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
main-HASH.module.js 14.2 kB 14.2 kB
main-HASH.module.js gzip 5.36 kB 5.36 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
16b1a7225520..e5.module.js 21.2 kB 21.2 kB
16b1a7225520..dule.js gzip 8.18 kB 8.18 kB
4952ddcd88e7..60.module.js 11.9 kB 11.9 kB
4952ddcd88e7..dule.js gzip 4.42 kB 4.42 kB
de003c3a9d30..80.module.js 15 kB 15 kB
de003c3a9d30..dule.js gzip 6.15 kB 6.15 kB
framework.HASH.module.js 126 kB 126 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
Overall change 189 kB 189 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
polyfills-HASH.js 15.3 kB 15.3 kB
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 15.3 kB 15.3 kB
Client Pages
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_app.js 2.93 kB 2.93 kB
_app.js gzip 1.33 kB 1.33 kB
_error.js 13.2 kB 13.2 kB
_error.js gzip 5.11 kB 5.11 kB
hooks.js 1.92 kB 1.92 kB
hooks.js gzip 943 B 943 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.78 kB 6.78 kB
link.js gzip 2.89 kB 2.89 kB
routerDirect.js 413 B 413 B
routerDirect.js gzip 285 B 285 B
withRouter.js 423 B 423 B
withRouter.js gzip 284 B 284 B
Overall change 26 kB 26 kB
Client Pages Modern
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_app.module.js 1.53 kB 1.53 kB
_app.module.js gzip 745 B 745 B
_error.module.js 10.3 kB 10.3 kB
_error.module.js gzip 4.24 kB 4.24 kB
hooks.module.js 651 B 651 B
hooks.module.js gzip 371 B 371 B
index.module.js 276 B 276 B
index.module.js gzip 212 B 212 B
link.module.js 5.45 kB 5.45 kB
link.module.js gzip 2.46 kB 2.46 kB
routerDirect.module.js 386 B 386 B
routerDirect..dule.js gzip 275 B 275 B
withRouter.module.js 396 B 396 B
withRouter.m..dule.js gzip 274 B 274 B
Overall change 19 kB 19 kB
Client Build Manifests
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_buildManifest.js 244 B 244 B
_buildManifest.js gzip 200 B 200 B
_buildManifest.module.js 251 B 251 B
_buildManife..dule.js gzip 209 B 209 B
Overall change 495 B 495 B
Rendered Page Sizes
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
index.html 4.06 kB 4.06 kB
index.html gzip 1.03 kB 1.03 kB
link.html 4.58 kB 4.58 kB
link.html gzip 1.11 kB 1.11 kB
withRouter.html 4.59 kB 4.59 kB
withRouter.html gzip 1.1 kB 1.1 kB
Overall change 13.2 kB 13.2 kB

Serverless Mode (Increase detected ⚠️)
General Overall increase ⚠️
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
buildDuration 15.8s 15.5s -227ms
nodeModulesSize 46.8 MB 46.8 MB ⚠️ +138 B
Client Bundles (main, webpack, commons)
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
main-HASH.js 18.3 kB 18.3 kB
main-HASH.js gzip 6.44 kB 6.44 kB
webpack-HASH.js 1.53 kB 1.53 kB
webpack-HASH.js gzip 746 B 746 B
16b1a7225520..10012f496.js 20 kB 20 kB
16b1a7225520..f496.js gzip 7.42 kB 7.42 kB
4952ddcd88e7..49d7903c2.js 9.61 kB 9.61 kB
4952ddcd88e7..03c2.js gzip 3.77 kB 3.77 kB
commons.HASH.js 10.4 kB 10.4 kB
commons.HASH.js gzip 3.91 kB 3.91 kB
de003c3a9d30..a5a0ede39.js 21.2 kB 21.2 kB
de003c3a9d30..de39.js gzip 8.19 kB 8.19 kB
framework.HASH.js 126 kB 126 kB
framework.HASH.js gzip 39.5 kB 39.5 kB
Overall change 207 kB 207 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
main-HASH.module.js 14.2 kB 14.2 kB
main-HASH.module.js gzip 5.36 kB 5.36 kB
webpack-HASH.module.js 1.53 kB 1.53 kB
webpack-HASH..dule.js gzip 746 B 746 B
16b1a7225520..e5.module.js 21.2 kB 21.2 kB
16b1a7225520..dule.js gzip 8.18 kB 8.18 kB
4952ddcd88e7..60.module.js 11.9 kB 11.9 kB
4952ddcd88e7..dule.js gzip 4.42 kB 4.42 kB
de003c3a9d30..80.module.js 15 kB 15 kB
de003c3a9d30..dule.js gzip 6.15 kB 6.15 kB
framework.HASH.module.js 126 kB 126 kB
framework.HA..dule.js gzip 39.4 kB 39.4 kB
Overall change 189 kB 189 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
polyfills-HASH.js 15.3 kB 15.3 kB
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 15.3 kB 15.3 kB
Client Pages
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_app.js 2.93 kB 2.93 kB
_app.js gzip 1.33 kB 1.33 kB
_error.js 13.2 kB 13.2 kB
_error.js gzip 5.11 kB 5.11 kB
hooks.js 1.92 kB 1.92 kB
hooks.js gzip 943 B 943 B
index.js 318 B 318 B
index.js gzip 222 B 222 B
link.js 6.78 kB 6.78 kB
link.js gzip 2.89 kB 2.89 kB
routerDirect.js 413 B 413 B
routerDirect.js gzip 285 B 285 B
withRouter.js 423 B 423 B
withRouter.js gzip 284 B 284 B
Overall change 26 kB 26 kB
Client Pages Modern
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_app.module.js 1.53 kB 1.53 kB
_app.module.js gzip 745 B 745 B
_error.module.js 10.3 kB 10.3 kB
_error.module.js gzip 4.24 kB 4.24 kB
hooks.module.js 651 B 651 B
hooks.module.js gzip 371 B 371 B
index.module.js 276 B 276 B
index.module.js gzip 212 B 212 B
link.module.js 5.45 kB 5.45 kB
link.module.js gzip 2.46 kB 2.46 kB
routerDirect.module.js 386 B 386 B
routerDirect..dule.js gzip 275 B 275 B
withRouter.module.js 396 B 396 B
withRouter.m..dule.js gzip 274 B 274 B
Overall change 19 kB 19 kB
Client Build Manifests
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_buildManifest.js 244 B 244 B
_buildManifest.js gzip 200 B 200 B
_buildManifest.module.js 251 B 251 B
_buildManife..dule.js gzip 209 B 209 B
Overall change 495 B 495 B
Serverless bundles
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_error.js 256 kB 256 kB
_error.js gzip 67.9 kB 67.9 kB
hooks.html 4.19 kB 4.19 kB
hooks.html gzip 1.07 kB 1.07 kB
index.js 256 kB 256 kB
index.js gzip 68 kB 68 kB
link.js 289 kB 289 kB
link.js gzip 77.2 kB 77.2 kB
routerDirect.js 282 kB 282 kB
routerDirect.js gzip 75.2 kB 75.2 kB
withRouter.js 282 kB 282 kB
withRouter.js gzip 75.3 kB 75.3 kB
Overall change 1.37 MB 1.37 MB

Commit: e6375e4

@oliviertassinari
Copy link
Contributor

oliviertassinari commented Jan 20, 2020

@Timer Babel documents that using the version can reduce the bundle size. Should it be further detailed? Maybe it's not significant or incorrect?

which results in a smaller bundle size.

https://babeljs.io/docs/en/babel-plugin-transform-runtime#version

@ijjk
Copy link
Member

ijjk commented Jan 20, 2020

Stats from current PR

Default Server Mode
General Overall increase ⚠️
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
buildDuration 13.8s 14.3s ⚠️ +465ms
nodeModulesSize 48.9 MB 48.9 MB ⚠️ +138 B
Client Bundles (main, webpack, commons)
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
main-HASH.js gzip 5.11 kB 5.11 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..fffc.js gzip 13.7 kB 13.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 67.5 kB 67.5 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
main-HASH.module.js gzip 4.17 kB 4.17 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..dule.js gzip 12.5 kB 12.5 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 62.1 kB 62.1 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 4.76 kB 4.76 kB
Client Pages
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_app.js gzip 1.34 kB 1.34 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js gzip 779 B 779 B
index.js gzip 222 B 222 B
link.js gzip 2.9 kB 2.9 kB
routerDirect.js gzip 283 B 283 B
withRouter.js gzip 282 B 282 B
Overall change 9.87 kB 9.87 kB
Client Pages Modern
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_app.module.js gzip 769 B 769 B
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js gzip 371 B 371 B
index.module.js gzip 212 B 212 B
link.module.js gzip 2.47 kB 2.47 kB
routerDirect..dule.js gzip 273 B 273 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 7.42 kB 7.42 kB
Client Build Manifests
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Rendered Page Sizes
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
index.html gzip 1.02 kB 1.02 kB
link.html gzip 1.03 kB 1.03 kB
withRouter.html gzip 1.01 kB 1.01 kB
Overall change 3.06 kB 3.06 kB

Serverless Mode
General Overall increase ⚠️
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
buildDuration 14.8s 14.5s -338ms
nodeModulesSize 48.9 MB 48.9 MB ⚠️ +138 B
Client Bundles (main, webpack, commons)
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
main-HASH.js gzip 5.11 kB 5.11 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..fffc.js gzip 13.7 kB 13.7 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 67.5 kB 67.5 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
main-HASH.module.js gzip 4.17 kB 4.17 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..dule.js gzip 12.5 kB 12.5 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 62.1 kB 62.1 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 4.76 kB 4.76 kB
Client Pages
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_app.js gzip 1.34 kB 1.34 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js gzip 779 B 779 B
index.js gzip 222 B 222 B
link.js gzip 2.9 kB 2.9 kB
routerDirect.js gzip 283 B 283 B
withRouter.js gzip 282 B 282 B
Overall change 9.87 kB 9.87 kB
Client Pages Modern
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_app.module.js gzip 769 B 769 B
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js gzip 371 B 371 B
index.module.js gzip 212 B 212 B
link.module.js gzip 2.47 kB 2.47 kB
routerDirect..dule.js gzip 273 B 273 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 7.42 kB 7.42 kB
Client Build Manifests
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Serverless bundles
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_error.js gzip 70.9 kB 70.9 kB
hooks.html gzip 1.05 kB 1.05 kB
index.js gzip 71.3 kB 71.3 kB
link.js gzip 80.6 kB 80.6 kB
routerDirect.js gzip 78.2 kB 78.2 kB
withRouter.js gzip 78.3 kB 78.3 kB
Overall change 380 kB 380 kB

Commit: fad8b42

@eps1lon
Copy link
Member Author

eps1lon commented Jan 20, 2020

@Timer Babel documents that using the version can reduce the bundle size.

To be clear: This statement is based on my experience. Though it was approved so either the maintainers think the same or missed it.

@merceyz
Copy link
Contributor

merceyz commented Jan 20, 2020

Though it was approved so either the maintainers think the same or missed it.

They've said so on multiple occasions, so they didn't miss it.

[...] the helper has been updated, so Babel must inline it to ensure that you are using the new version (just in case your @babel/runtime is old). You can prevent this by passing a "version": "^7.6.0" (or whatever you are using) to tell "Hey Babel, I'm already using a version which includes the new feature. You don't need to inline it!".

babel/babel#11013 (comment)

The helpers are inlined because transform-runtime doesn't know if they are included in babel/helpers. In this case, it will assume you are using babel/helpers 7.0.0-beta.0, which means every helper introduced later than 7.0.0-beta.0 will be inlined instead of require. Specifying a version field helps transform-runtime to generate imports of helpers.

babel/babel#10261 (comment)

@Timer Timer added this to the 9.2.1 milestone Jan 20, 2020
Copy link
Member

@Timer Timer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still haven't seen proof of any bundle size reduction, but this seems fine.

@ijjk
Copy link
Member

ijjk commented Jan 20, 2020

Stats from current PR

Default Server Mode
General Overall increase ⚠️
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
buildDuration 13.8s 13.9s ⚠️ +125ms
nodeModulesSize 48.8 MB 48.8 MB ⚠️ +138 B
Client Bundles (main, webpack, commons)
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
main-HASH.js gzip 5.11 kB 5.11 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..c512.js gzip 16.3 kB 16.3 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 70 kB 70 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
main-HASH.module.js gzip 4.17 kB 4.17 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..dule.js gzip 15.1 kB 15.1 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 64.7 kB 64.7 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 4.76 kB 4.76 kB
Client Pages
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_app.js gzip 1.34 kB 1.34 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js gzip 779 B 779 B
index.js gzip 222 B 222 B
link.js gzip 2.9 kB 2.9 kB
routerDirect.js gzip 283 B 283 B
withRouter.js gzip 282 B 282 B
Overall change 9.87 kB 9.87 kB
Client Pages Modern
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_app.module.js gzip 769 B 769 B
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js gzip 371 B 371 B
index.module.js gzip 212 B 212 B
link.module.js gzip 2.47 kB 2.47 kB
routerDirect..dule.js gzip 273 B 273 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 7.42 kB 7.42 kB
Client Build Manifests
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Rendered Page Sizes
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
index.html gzip 1.02 kB 1.02 kB
link.html gzip 1.03 kB 1.03 kB
withRouter.html gzip 1.02 kB 1.02 kB
Overall change 3.06 kB 3.06 kB

Serverless Mode
General Overall increase ⚠️
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
buildDuration 14.5s 14.6s ⚠️ +38ms
nodeModulesSize 48.8 MB 48.8 MB ⚠️ +138 B
Client Bundles (main, webpack, commons)
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
main-HASH.js gzip 5.11 kB 5.11 kB
webpack-HASH.js gzip 746 B 746 B
4952ddcd88e7..54d3.js gzip 4.68 kB 4.68 kB
commons.HASH.js gzip 4.06 kB 4.06 kB
de003c3a9d30..c512.js gzip 16.3 kB 16.3 kB
framework.HASH.js gzip 39.1 kB 39.1 kB
Overall change 70 kB 70 kB
Client Bundles (main, webpack, commons) Modern
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
main-HASH.module.js gzip 4.17 kB 4.17 kB
webpack-HASH..dule.js gzip 746 B 746 B
4952ddcd88e7..dule.js gzip 5.56 kB 5.56 kB
de003c3a9d30..dule.js gzip 15.1 kB 15.1 kB
framework.HA..dule.js gzip 39.1 kB 39.1 kB
Overall change 64.7 kB 64.7 kB
Legacy Client Bundles (polyfills)
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
polyfills-HASH.js gzip 4.76 kB 4.76 kB
Overall change 4.76 kB 4.76 kB
Client Pages
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_app.js gzip 1.34 kB 1.34 kB
_error.js gzip 4.07 kB 4.07 kB
hooks.js gzip 779 B 779 B
index.js gzip 222 B 222 B
link.js gzip 2.9 kB 2.9 kB
routerDirect.js gzip 283 B 283 B
withRouter.js gzip 282 B 282 B
Overall change 9.87 kB 9.87 kB
Client Pages Modern
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_app.module.js gzip 769 B 769 B
_error.module.js gzip 3.06 kB 3.06 kB
hooks.module.js gzip 371 B 371 B
index.module.js gzip 212 B 212 B
link.module.js gzip 2.47 kB 2.47 kB
routerDirect..dule.js gzip 273 B 273 B
withRouter.m..dule.js gzip 272 B 272 B
Overall change 7.42 kB 7.42 kB
Client Build Manifests
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_buildManifest.js gzip 61 B 61 B
_buildManife..dule.js gzip 61 B 61 B
Overall change 122 B 122 B
Serverless bundles
zeit/next.js canary eps1lon/next.js feat/transform-runtime-version Change
_error.js gzip 70.9 kB 70.9 kB
hooks.html gzip 1.05 kB 1.05 kB
index.js gzip 71.3 kB 71.3 kB
link.js gzip 80.6 kB 80.6 kB
routerDirect.js gzip 78.2 kB 78.2 kB
withRouter.js gzip 78.3 kB 78.3 kB
Overall change 380 kB 380 kB

Commit: eb3e6fb

@Timer
Copy link
Member

Timer commented Feb 18, 2020

FYI: Next.js no longer polyfills with core-js. See #10574.

@vercel vercel locked as resolved and limited conversation to collaborators Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants