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

Use builtins for React transform #10207

Merged
merged 9 commits into from Jan 22, 2020
2 changes: 1 addition & 1 deletion packages/next/client/router.ts
Expand Up @@ -138,7 +138,7 @@ export function makePublicRouterInstance(router: Router): NextRouter {

for (const property of urlPropertyFields) {
if (typeof _router[property] === 'object') {
instance[property] = { ..._router[property] } // makes sure query is not stateful
instance[property] = Object.assign({}, _router[property]) // makes sure query is not stateful
continue
}

Expand Down
11 changes: 8 additions & 3 deletions packages/next/taskfile-babel.js
Expand Up @@ -15,10 +15,15 @@ const babelClientOpts = {
esmodules: true,
},
loose: true,
exclude: ['transform-typeof-symbol'],
// This is handled by the Next.js webpack config that will run next/babel over the same code.
exclude: [
'transform-typeof-symbol',
'transform-async-to-generator',
'transform-spread',
],
},
],
'@babel/preset-react',
['@babel/preset-react', { useBuiltIns: true }],
],
plugins: [
// workaround for @taskr/esnext bug replacing `-import` with `-require(`
Expand All @@ -31,7 +36,7 @@ const babelClientOpts = {
const babelServerOpts = {
presets: [
'@babel/preset-typescript',
'@babel/preset-react',
['@babel/preset-react', { useBuiltIns: true }],
[
'@babel/preset-env',
{
Expand Down
4 changes: 2 additions & 2 deletions test/integration/size-limit/test/index.test.js
Expand Up @@ -81,7 +81,7 @@ describe('Production response size', () => {
)

// These numbers are without gzip compression!
const delta = responseSizeKilobytes - 235
const delta = responseSizeKilobytes - 233
expect(delta).toBeLessThanOrEqual(0) // don't increase size
expect(delta).toBeGreaterThanOrEqual(-1) // don't decrease size without updating target
})
Expand All @@ -101,7 +101,7 @@ describe('Production response size', () => {
)

// These numbers are without gzip compression!
const delta = responseSizeKilobytes - 203
const delta = responseSizeKilobytes - 202
expect(delta).toBeLessThanOrEqual(0) // don't increase size
expect(delta).toBeGreaterThanOrEqual(-1) // don't decrease size without updating target
})
Expand Down