-
-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
patak-dev
merged 6 commits into
vitejs:main
from
sapphi-red:fix/scanner-respect-experimental-decorators
Feb 21, 2024
Merged
Changes from 1 commit
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
5db7c1a
fix(scanner): respect `experimentalDecorators: true`
sapphi-red cd641b0
chore: fix typecheck
sapphi-red f1d40a9
fix: add resolveDir to `namespace: 'html'`
sapphi-red b1cac17
chore: merge main
sapphi-red 2077ede
chore: revert changes to esbuild plugin
sapphi-red 10f7e4c
fix: load root tsconfig experimentalDecorators option
sapphi-red File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
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 enablingLooks like I explicitly removedexperimentalDecorators
by default only for scanningexperimentalDecorators
support in scanning. Hmm I'm confused though why esbuild doesn't respect the tsconfig if we manually resolve.There was a problem hiding this comment.
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
callsfinalizeResolve
which resolves tsconfig)There was a problem hiding this comment.
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.There was a problem hiding this comment.
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 tofalse
)There was a problem hiding this comment.
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 inferexperimentalDecorators
from there? Seems like there will always be a tradeoff, but worst case they could manually disable/enable it withesbuildOptions.tsconfigRaw
perhaps.