Builds failing with error: Binding not found for ReferencedIdentifier "createOption" present in "AssignmentExpression"
- Dominant language
- JavaScript
- Stars
- 4.4k
- Forks
- 217
- PR merge metrics
- No merged PRs in 30d
Description
Our builds started failing yesterday. When we override @babel/traverse to 7.25.9, the builds are working fine. @babel/traverse v7.26.3 seems to be the culprit.
1. Minimal code to reproduce the bug
Angular app running Storybook
3. Stack Trace
```
Error: /azp/_work/1/s/tools/src/storybook/argTypes/api.ts: Binding not found for ReferencedIdentifier "createOption" present in "AssignmentExpression". Please report this at https://github.com/babel/minify/issues/new
at ReferencedIdentifier (/azp/_work/1/s/node_modules/babel-plugin-minify-mangle-names/lib/index.js:199:19)
at newFn (/azp/_work/1/s/node_modules/@babel/traverse/lib/visitors.js:205:17)
at bfsTraverse (/azp/_work/1/s/node_modules/babel-plugin-minify-mangle-names/lib/bfs-traverse.js:38:43)
at Mangler.collect (/azp/_work/1/s/node_modules/babel-plugin-minify-mangle-names/lib/index.js:235:7)
at Mangler.run (/azp/_work/1/s/node_modules/babel-plugin-minify-mangle-names/lib/index.js:60:12)
at PluginPass.exit (/azp/_work/1/s/node_modules/babel-plugin-minify-mangle-names/lib/index.js:546:19)
at newFn (/azp/_work/1/s/node_modules/@babel/traverse/lib/visitors.js:170:14)
at NodePath._call (/azp/_work/1/s/node_modules/@babel/traverse/lib/path/context.js:50:20)
at NodePath.call (/azp/_work/1/s/node_modules/@babel/traverse/lib/path/context.js:40:18)
at NodePath.visit (/azp/_work/1/s/node_modules/@babel/traverse/lib/path/context.js:97:8) {
code: 'BABEL_TRANSFORM_ERROR'
}
##[error]> 1
##[error]Bash exited with code '1'.
```
4. Configuration - babel-minify configuration or babelrc
```
module.exports = {
plugins: [
[
'inline-dotenv',
{
unsafe: true,
},
],
],
presets: [
['minify'],
'@babel/preset-env',
'@babel/preset-typescript',
'@babel/preset-react',
],
};
```
6. Whether you used it with other presets/plugins - like es2015 or env
See below
8. Environment: gulp, rollup, webpack, babel-cli, etc...?
```
"@babel/cli": "^7.13.0",
"@babel/core": "^7.14.0",
"@babel/eslint-parser": "^7.21.3",
"@babel/preset-env": "^7.14.0",
"@babel/preset-react": "^7.13.0",
"@babel/preset-typescript": "^7.13.0",
```
Contributor guide
Research direction
Reproduce the Angular/Storybook build with @babel/traverse 7.26.3 and compare it with 7.25.9. Inspect babel-plugin-minify-mangle-names/lib/index.js and bfs-traverse.js at the stack-trace locations, then determine whether the failure is caused by the traversal change. Done means the reported build succeeds without the binding error and a regression test covers the case.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- babel, javascript
- Domain
- build-system, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100