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

feat: Add extension to relative imports/exports in declaration files #29

Merged
merged 3 commits into from
Jan 26, 2024

Conversation

lachlancollins
Copy link
Member

@lachlancollins lachlancollins commented Jan 26, 2024

Uses the following regex to add .js or .cjs extensions to declaration files:

content = content.replace(
  /^import\s[\w{}*\s,]+from\s['"]\.\/[^.'"]+(?=['"];?$)/gm,
  '$&.js',
)

content = content.replace(
  /^export\s[\w{}*\s,]+from\s['"]\.\/[^.'"]+(?=['"];?$)/gm,
  '$&.js',
)

Added @arethetypeswrong/cli to ensure all module resolutions pass.

Fixes TanStack/router#1087

@lachlancollins lachlancollins marked this pull request as ready for review January 26, 2024 22:26
@lachlancollins lachlancollins changed the title feat: Add extension to relative imports/exports feat: Add extension to relative imports/exports in declaration files Jan 26, 2024
@lachlancollins lachlancollins merged commit 82f782a into main Jan 26, 2024
1 check passed
@lachlancollins lachlancollins deleted the extension branch January 26, 2024 22:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Generated d.ts files for ESM don’t have file extensions
1 participant