Do not transpile typeof helper with itself in babel/runtime (#10788)
* Do not transpile typeof helper with itself in babel/runtime * Nits * Remove console.log
This commit is contained in:
parent
d18afbd7c3
commit
3d0c5d2afc
@ -24,6 +24,7 @@
|
|||||||
"@babel/core": "^7.7.4",
|
"@babel/core": "^7.7.4",
|
||||||
"@babel/helper-plugin-test-runner": "^7.7.4",
|
"@babel/helper-plugin-test-runner": "^7.7.4",
|
||||||
"@babel/helpers": "^7.7.4",
|
"@babel/helpers": "^7.7.4",
|
||||||
|
"@babel/plugin-transform-typeof-symbol": "^7.7.4",
|
||||||
"@babel/preset-env": "^7.7.4",
|
"@babel/preset-env": "^7.7.4",
|
||||||
"@babel/runtime": "^7.7.4",
|
"@babel/runtime": "^7.7.4",
|
||||||
"@babel/template": "^7.7.4",
|
"@babel/template": "^7.7.4",
|
||||||
|
|||||||
@ -9,6 +9,7 @@ const t = require("@babel/types");
|
|||||||
|
|
||||||
const transformRuntime = require("../");
|
const transformRuntime = require("../");
|
||||||
|
|
||||||
|
const runtimeVersion = require("@babel/runtime/package.json").version;
|
||||||
const corejs2Definitions = require("../lib/runtime-corejs2-definitions").default();
|
const corejs2Definitions = require("../lib/runtime-corejs2-definitions").default();
|
||||||
const corejs3Definitions = require("../lib/runtime-corejs3-definitions").default();
|
const corejs3Definitions = require("../lib/runtime-corejs3-definitions").default();
|
||||||
|
|
||||||
@ -151,15 +152,30 @@ function buildHelper(
|
|||||||
tree.body.push(...helper.nodes);
|
tree.body.push(...helper.nodes);
|
||||||
|
|
||||||
return babel.transformFromAst(tree, null, {
|
return babel.transformFromAst(tree, null, {
|
||||||
presets: [[require("@babel/preset-env"), { modules: false }]],
|
filename: helperFilename,
|
||||||
|
presets: [
|
||||||
|
[
|
||||||
|
"@babel/preset-env",
|
||||||
|
{ modules: false, exclude: ["@babel/plugin-transform-typeof-symbol"] },
|
||||||
|
],
|
||||||
|
],
|
||||||
plugins: [
|
plugins: [
|
||||||
[transformRuntime, { corejs, useESModules: esm }],
|
[
|
||||||
|
transformRuntime,
|
||||||
|
{ corejs, useESModules: esm, version: runtimeVersion },
|
||||||
|
],
|
||||||
buildRuntimeRewritePlugin(
|
buildRuntimeRewritePlugin(
|
||||||
runtimeName,
|
runtimeName,
|
||||||
path.relative(path.dirname(helperFilename), pkgDirname),
|
path.relative(path.dirname(helperFilename), pkgDirname),
|
||||||
helperName
|
helperName
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
|
overrides: [
|
||||||
|
{
|
||||||
|
exclude: /typeof/,
|
||||||
|
plugins: ["@babel/plugin-transform-typeof-symbol"],
|
||||||
|
},
|
||||||
|
],
|
||||||
}).code;
|
}).code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user