-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Allow TypeScript in hoisted scripts #3665
Conversation
🦋 Changeset detectedLatest commit: c209c8a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Not sure if needed, but I think a test for importing files with various extensions (no extension, js extension for ts file etc) should be added since that's been a common issue inside the frontmatter |
interface Props { | ||
name: string; | ||
} |
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.
Ooh is the compiler ready for this? We follow 4.12.1.3 so I think generics should be fine...
Would be nice to test! LMK if you think that should be in the compiler rather than here.
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.
Not sure I follow, this is tested, this file is a test file.
@Princesseuh added tests for imports. Thanks for suggesting that, needed to make that work. |
@@ -1,3 +1,11 @@ | |||
<script> | |||
console.log('some content here.'); | |||
import '../scripts/some-files/one'; | |||
import '../scripts/some-files/two.ts'; |
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.
Missing a .js import for a ts file (ex, one.js for one.ts)
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.
fixed!
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.
Nice, looks good to me! Clever fix just being able to tell Vite lang="ts"
👍
Need to check something in the rollup docs before merging this. |
* Allow TypeScript in hoisted scripts * Pass skipSelf * Fix linting
Changes
&lang.ts
to the module id of hoisted scripts. This makes it so that Vite treats these are TypeScript.Testing
Docs
N/A, bug fix.