fix(vite): resolve ESM types correctly under NodeNext and Deno#626
Merged
Conversation
The import condition now points at a real ESM entry (src/index.mjs) typed by index.d.mts (export default), while require keeps index.d.ts (export =). Previously both conditions served the CJS file typed with export =, which TypeScript 6 / Deno 2.8.3+ reject when resolved through the import condition. Also inline FilterPattern instead of importing it from @rollup/pluginutils, whose types do not resolve under NodeNext. Fixes #625
🦋 Changeset detectedLatest commit: 4bbe51f 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 |
|
thx |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Problem
TypeScript 6.0 (shipped in Deno v2.8.3) rejects
export =declarations resolved through anexports.importcondition as a hard error, breakingdeno checkfor every Fresh user depending on@prefresh/vite.Fixes #625
Changes
exportsmap per condition:importnow resolves to a real ESM entry (src/index.mjs, a thin wrapper re-exporting the plugin as default) typed by a newindex.d.mtsusingexport default, whilerequirekeepssrc/index.jstyped byindex.d.tsusingexport =.FilterPatterntype in both declaration files.@rollup/pluginutils@4's types don't resolve undermoduleResolution: NodeNext(TS7016), which broke any consumer type-checking withoutskipLibCheck.filesarray (dist/runtime/utilsdon't exist in this package) tosrc,index.d.ts,index.d.mts. The published tarball previously only worked because npm auto-includes themainfile.