-
Notifications
You must be signed in to change notification settings - Fork 26.1k
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
Use modern syntax in Next client code (e.g. async await) #7014
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Stats from current PRClick to expand stats
Click to expand serverless stats
|
keanulee
force-pushed
the
async-await-output
branch
from
April 12, 2019 15:06
2a85890
to
9365741
Compare
Rebased to |
Stats from current PRClick to expand stats
Click to expand serverless stats
|
keanulee
force-pushed
the
async-await-output
branch
from
April 12, 2019 18:39
9365741
to
cfd4f5a
Compare
Stats from current PRClick to expand stats
Click to expand serverless stats
|
timneutkens
requested review from
dav-is,
ijjk,
lfades,
Timer and
timneutkens
as code owners
May 1, 2019 16:48
Stats from current PRClick to expand stats
Click to expand serverless stats
|
Stats from current PRClick to expand stats
Click to expand serverless stats
|
timneutkens
changed the title
[proposal] Use modern syntax in Next client code (e.g. async await)
Use modern syntax in Next client code (e.g. async await)
May 1, 2019
🚀 Thank you @keanulee |
keanulee
added a commit
to keanulee/next.js
that referenced
this pull request
May 1, 2019
ijjk
pushed a commit
that referenced
this pull request
May 1, 2019
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The idea is to allow Next apps targeting modern browsers only to reduce JS bundle size by removing regenerator/helper code from the transpiled Next client code (e.g.
/node_modules/next/dist/{client,pages}
. To benefit from this optimization, the app author will need to specify a.babelrc
/babel.config.js
file that targets modern browsers (e.g. see the additions totest/integration/basic/
, which are in this PR for demonstration purposes only). Otherwise, the using the defaultnext/babel
preset will still result in the Next client code being transpiled (non-breaking change).To get a sense of the benefit, here's the difference when applied to the
test/integration/basic/
example with the.babelrc
/babel.config.js
in this PR:Before (8x.x KB gzip):
After (7x.x KB gzip):
Note: To make user app code be compatible with the built Next client code, I had to setFixed by running next client libraries through plugin-transform-modules-commonjs as well in next-babel-loader.jsmodules: 'commonjs'
in thenext/babel
preset. From what I understand, this may break tree-shaking in webpack. So probably need to investigate this potential issue further.