未验证 提交 6988a2e0 编写于 作者: T Tim Neutkens 提交者: GitHub

Use builtins for React transform (#10207)

* Disable core-js on Next.js core files as it's not transforming anything important

* Move babel options to taskr plugin

* Disable transform-runtime for pages dir

* Disable correctly

* Disable corejs for core files

* Temporarily check if this fixes the error

* Use builtIns and exclude async-to-generator

* Update index.test.js
上级 4a2236da
......@@ -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
}
......
......@@ -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(`
......@@ -31,7 +36,7 @@ const babelClientOpts = {
const babelServerOpts = {
presets: [
'@babel/preset-typescript',
'@babel/preset-react',
['@babel/preset-react', { useBuiltIns: true }],
[
'@babel/preset-env',
{
......
......@@ -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
})
......@@ -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
})
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册