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

fix(scanner): respect experimentalDecorators: true #15206

Merged

Conversation

sapphi-red
Copy link
Member

Description

I totally forgot about #13805 (comment).

fixes #15201
refs #14804

Additional context


What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Before submitting the PR, please make sure you do the following

  • Read the Contributing Guidelines, especially the Pull Request Guidelines.
  • Check that there isn't already a PR that solves the problem the same way to avoid creating a duplicate.
  • Provide a description in this PR that addresses what the PR is solving, or reference the issue that it solves (e.g. fixes #123).
  • Update the corresponding documentation if needed.
  • Ideally, include relevant tests that fail without this PR but pass with it.

@sapphi-red sapphi-red added p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release labels Dec 1, 2023
Copy link

stackblitz bot commented Dec 1, 2023

Review PR in StackBlitz Codeflow Run & review this pull request in StackBlitz Codeflow.

Comment on lines 617 to 618
// make esbuild handle js/ts/jsx/tsx
// so that tsconfig.json is respected by esbuild
Copy link
Member

@bluwy bluwy Dec 4, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would this mean that we let esbuild resolve instead? Wouldn't that possibly diverge from Vite's resolver that we want to use instead?

Maybe we can fix this issue by enabling experimentalDecorators by default only for scanning Looks like I explicitly removed experimentalDecorators support in scanning. Hmm I'm confused though why esbuild doesn't respect the tsconfig if we manually resolve.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm true.
It seems esbuild doesn't support reading tsconfig.json if the plugin resolved the path (evanw/esbuild#2265).

related code: the part resolving tsconfig, resolver (res.Resolve calls finalizeResolve which resolves tsconfig)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As much as I'd like to avoid it, maybe reverting and enabling back experimentalDecorators for scanning would be the easier way for now 🤔 I think it shouldn't hurt too much since we only need to scan things.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reading microsoft/TypeScript#50820, it seems there's some incompatibilities between the syntax of them unfortunately. 😢
Example 1 .(private fields), Example 2 (class expressions) (the error disappears if experimentalDecorators is set to false)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Dang, perhaps what we can do for now is manually read the project's tsconfig.json and then infer experimentalDecorators from there? Seems like there will always be a tradeoff, but worst case they could manually disable/enable it with esbuildOptions.tsconfigRaw perhaps.

@sapphi-red
Copy link
Member Author

It's been a while, but I changed it this way (#15206 (comment)).

@sapphi-red
Copy link
Member Author

/ecosystem-ci run

@vite-ecosystem-ci
Copy link

📝 Ran ecosystem CI on 10f7e4c: Open

suite result latest scheduled
analogjs success success
astro success success
histoire success success
ladle success success
laravel success success
marko success success
nuxt success success
nx failure failure
previewjs success success
qwik failure failure
rakkas success success
sveltekit success success
unocss success success
vike failure failure
vite-plugin-pwa success success
vite-plugin-react success success
vite-plugin-react-pages success success
vite-plugin-react-swc success success
vite-plugin-svelte success success
vite-plugin-vue success success
vite-setup-catalogue success success
vitepress success success
vitest success success

Copy link
Member

@bluwy bluwy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for updating!

@patak-dev patak-dev merged commit 4144781 into vitejs:main Feb 21, 2024
10 checks passed
@sapphi-red sapphi-red deleted the fix/scanner-respect-experimental-decorators branch March 14, 2024 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-minor-bug An edge case that only affects very specific usage (priority) regression The issue only appears after a new release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tsconfig seems to be ignored
3 participants