-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Closed
Labels
Has PRoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue
Description
Choose one: bug report
The error message
TypeError: test.js: Duplicate declaration "tmp" (This is an error on an internal node. Probably an internal error.)
is shown when transpiling the input code. node successfully executes the input code.
Input Code
async function foo() {
(async function (number) {
const tmp = number
})
}Babel/Babylon Configuration (.babelrc, package.json, cli command)
{ "presets": [ [ "@babel/env"
, { "targets": { "browsers": [ "last 2 chrome versions"
, "last 2 chromeandroid versions"
, "firefox esr"
, "last 2 firefox versions"
, "edge >= 15"
, "safari >= 11"
]
}
, "debug": true
}
]
]
}{
"dependencies": {
"@babel/cli": "^7.0.0-beta.32",
"@babel/core": "^7.0.0-beta.32",
"@babel/preset-env": "^7.0.0-beta.32",
"regenerator-runtime": "^0.11.0"
}
}Expected Behavior
The script is successfully transpiled.
Current Behavior
The given error message appears:
root@3f46f465fd04:/pwd# yarn run babel test.js
yarn run v1.3.2
warning package.json: No license field
$ /pwd/node_modules/.bin/babel test.js
@babel/preset-env: `DEBUG` option
Using targets:
{
"chrome": "61",
"edge": "15",
"firefox": "52",
"safari": "11"
}
Using modules transform: commonjs
Using plugins:
transform-destructuring { "edge":"15", "firefox":"52" }
transform-for-of { "firefox":"52" }
transform-function-name { "edge":"15", "firefox":"52" }
transform-literals { "firefox":"52" }
transform-parameters { "firefox":"52" }
transform-regenerator { "firefox":"52" }
Using polyfills: No polyfills were added, since the `useBuiltIns` option was not set.
TypeError: test.js: Duplicate declaration "tmp" (This is an error on an internal node. Probably an internal error.)
at File.buildCodeFrameError (/pwd/node_modules/@babel/core/lib/transformation/file/file.js:209:12)
at Scope.checkBlockScopedCollisions (/pwd/node_modules/@babel/traverse/lib/scope/index.js:295:27)
at Scope.registerBinding (/pwd/node_modules/@babel/traverse/lib/scope/index.js:477:16)
at Scope.registerDeclaration (/pwd/node_modules/@babel/traverse/lib/scope/index.js:396:14)
at Object.Declaration (/pwd/node_modules/@babel/traverse/lib/scope/index.js:89:12)
at NodePath._call (/pwd/node_modules/@babel/traverse/lib/path/context.js:64:19)
at NodePath.call (/pwd/node_modules/@babel/traverse/lib/path/context.js:38:17)
at NodePath.visit (/pwd/node_modules/@babel/traverse/lib/path/context.js:95:12)
at TraversalContext.visitQueue (/pwd/node_modules/@babel/traverse/lib/context.js:139:18)
at TraversalContext.visitMultiple (/pwd/node_modules/@babel/traverse/lib/context.js:93:17)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Possible Solution
Context
It worked fine with babel-preset-env in version 1.5.2. It is broken with @babel/preset-env in version 7.0.0-beta.32.
Your Environment
| software | version(s) |
|---|---|
| Babel | 7.0.0-beta.32 (@babel/core 7.0.0-beta.32) |
| Babylon | |
| node | v9.2.0 |
| npm | 5.5.1 |
| Operating System | Official node.js Docker container |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Has PRoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issueA closed issue/PR that is archived due to age. Recommended to make a new issue