Title: Duplicated identifier used when mangle is enabled · Issue #1155 · terser/terser · GitHub
Open Graph Title: Duplicated identifier used when mangle is enabled · Issue #1155 · terser/terser
X Title: Duplicated identifier used when mangle is enabled · Issue #1155 · terser/terser
Description: Bug report Terser is using the same identifier for the function, and for the const defined inside the if. This produces code that can't be evaluated. Here is a simple reproduction case: function f1() { if (true) { function f2() { return ...
Open Graph Description: Bug report Terser is using the same identifier for the function, and for the const defined inside the if. This produces code that can't be evaluated. Here is a simple reproduction case: function f1...
X Description: Bug report Terser is using the same identifier for the function, and for the const defined inside the if. This produces code that can't be evaluated. Here is a simple reproduction case: functio...
Opengraph URL: https://github.com/terser/terser/issues/1155
X: @github
Domain: github-redirect.dependabot.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Duplicated identifier used when mangle is enabled","articleBody":"**Bug report**\r\n\r\nTerser is using the same identifier for the function, and for the const defined inside the if. This produces code that can't be evaluated.\r\n\r\nHere is a simple reproduction case:\r\n\r\n```js\r\nfunction f1() {\r\n\tif (true) {\r\n\t\tfunction f2() {\r\n\t\t\treturn 1;\r\n\t\t}\r\n\r\n\t\tconst var1 = 666;\r\n\t}\r\n}\r\n```\r\n\r\nIf var1 is outside the \"if\", the correct identifier is used when minifying.\r\n\r\nUsed options:\r\n\r\n```js\r\n{\r\n module: true,\r\n compress: {\r\n unused: false\r\n }\r\n}\r\n```\r\n\r\n**Curent terser output**\r\n\r\n```js\r\nfunction n(){{function n(){return 1}const n=666}}\r\n```\r\n\r\nnote the inner function n() and the const n, they clash.","author":{"url":"https://github.com/renanccastro","@type":"Person","name":"renanccastro"},"datePublished":"2022-02-24T18:38:05.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":3},"url":"https://github.com/1155/terser/issues/1155"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:9922c1b5-2f27-1c36-1943-79a463b662f1 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 8FAC:1FDCF6:293D8BF:36F5155:6A655D52 |
| html-safe-nonce | ddbede8f9f0088be9adddd5c3c50127b03f695ee050eaa0e3aa2ac2a48ccc02f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4RkFDOjFGRENGNjoyOTNEOEJGOjM2RjUxNTU6NkE2NTVENTIiLCJ2aXNpdG9yX2lkIjoiODI4MDE2NTEyODQ0MjU2ODAxOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 854ace88427eb05ff618c33433ae477bbf7d643a786a5d45965dc68d044aed38 |
| hovercard-subject-tag | issue:1149621241 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/terser/terser/1155/issue_layout |
| twitter:image | https://opengraph.githubassets.com/7ad04a8e54d47727ee2ad3756ccb57903ae5a165df7208f73ccbce0f5ddf9534/terser/terser/issues/1155 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/7ad04a8e54d47727ee2ad3756ccb57903ae5a165df7208f73ccbce0f5ddf9534/terser/terser/issues/1155 |
| og:image:alt | Bug report Terser is using the same identifier for the function, and for the const defined inside the if. This produces code that can't be evaluated. Here is a simple reproduction case: function f1... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | renanccastro |
| hostname | github.com |
| expected-hostname | github.com |
| None | 52c76df668885aaff23b50bdca1fa1ea44ac9c1553e888ebc70ff1e4daa4625b |
| turbo-cache-control | no-preview |
| go-import | github.com/terser/terser git https://github.com/terser/terser.git |
| octolytics-dimension-user_id | 43502240 |
| octolytics-dimension-user_login | terser |
| octolytics-dimension-repository_id | 29097127 |
| octolytics-dimension-repository_nwo | terser/terser |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 29097127 |
| octolytics-dimension-repository_network_root_nwo | terser/terser |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 309153364422b3c499922d1a2a6404910a58ed8e |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width