egoist / egoist/tsup

keepNames breaks on Chrome 38 / Safari 9

Open
#1,272 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
11.3k
Forks
275
PR merge metrics
No merged PRs in 30d

Description

Hi,
When the keepNames option is enabled, the generated code includes the following snippet:

```
var __defProp = Object.defineProperty;
var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
```

However, this code is not compatible with older browsers like Chrome 38 or Safari 9, as the "name" property is protected and returns the following error:

`Attempting to change configurable attribute of unconfigurable property`

After testing, I found that manually replacing "name" with another string (e.g., "propertyName") resolves the issue.

Would it be possible to replace "name" with a different string?

Thank you!

Contributor guide

Open the contributing guide

Research direction

Start by locating the generated __name helper and the keepNames code path that emits it, then reproduce the output for the older-browser case described in the issue. Done means keepNames no longer generates the incompatible assignment to the protected "name" property and the relevant compatibility behavior is covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
build-system
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.