-
Notifications
You must be signed in to change notification settings - Fork 2.1k
chore(turbo-types): add ESM exports #10747
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
Open
tknickman
wants to merge
19
commits into
main
Choose a base branch
from
tomknickman/turbo-4811-convert-turbotypes-to-esm
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Conversation
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
This commit converts the turbo-types package from CommonJS to ESM: - Renamed .eslintrc.js to .eslintrc.cjs for CommonJS config - Updated package.json to add "type": "module" and proper ESM exports - Modified import statements in src/index.ts to use .js extensions - Added JSON import using createRequire for compatibility - Updated tsconfig.json for ESM compilation with proper output directory The package now properly supports ESM with appropriate module resolution and export configurations for TypeScript consumers.
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Add explicit export for frameworks.json file to support direct imports from documentation site, maintaining backwards compatibility during ESM conversion. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
Implement dual package exports to support both ESM and CommonJS consumers: - Add separate build outputs for ESM (dist/esm) and CommonJS (dist/cjs) - Create dedicated TypeScript configs for each module format - Update package.json exports with proper conditional exports - Fix Jest compatibility issues by providing CommonJS build - Maintain backwards compatibility for existing consumers This resolves the "Cannot use import statement outside a module" error in Jest environments while preserving ESM functionality. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <[email protected]>
chris-olszewski
approved these changes
Aug 11, 2025
anthonyshew
added a commit
that referenced
this pull request
Aug 25, 2025
### Description Because JavaScript packaging is so finnicky, I'm thinking its a good idea to make sure our interfaces stay ecosystem compliant. PRs like #10747 and #10754 have potential to break things, so its nice to have some sanity checking. (I haven't checked yet if those PRs specifically are right, but they made me think about adding some tooling like this.) ### Testing Instructions CI
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.
[@anthonyshew took over this PR, description is mine]
Description
Dual-compiling this package so we can have an easier time converting its dependents to ESM.
Note that I'm using
zshyfor compilation, which uses an interesting pattern that breaks the strictness of publint and attw. For that reason, I'm opting to:zshy