Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typescript doc issue: document the breaking change that 2.5.0 enables useDefineForClassFields: true by default #4639

Closed
7 tasks done
SohumB opened this issue Aug 17, 2021 · 2 comments · Fixed by #4749
Closed
7 tasks done
Labels
documentation Improvements or additions to documentation has workaround

Comments

@SohumB
Copy link

SohumB commented Aug 17, 2021

Describe the bug

useDefineForClassFields is a breaking change for codebases that rely on the old emitting behaviour. A user with such a codebase whose tsconfig.json does not explicitly set this option to false will get breakages, error messages like can't redefine non-configurable property. This should be documented as a known issue with a workaround of setting this option back to false in your tsconfig.json.

Validations

@Shinigami92
Copy link
Member

Are you referring to this? #4279

@SohumB
Copy link
Author

SohumB commented Aug 17, 2021

That does appear to be the PR that introduced this behaviour, yes! It's since been published in 2.5.0.

Specifically the defaulting to true in this paragraph in plugins/esbuild.ts:

    if (loadedCompilerOptions.target?.toLowerCase() === 'esnext') {
      compilerOptionsForFile.useDefineForClassFields =
        loadedCompilerOptions.useDefineForClassFields ?? true
    }

@Shinigami92 Shinigami92 added documentation Improvements or additions to documentation has workaround and removed pending triage labels Aug 17, 2021
haoqunjiang added a commit to haoqunjiang/vite that referenced this issue Aug 26, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Sep 10, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
documentation Improvements or additions to documentation has workaround
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants