-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Remove .js
and .ts
from require / import
#4002
Conversation
Awesome! |
@captbaritone has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
|
||
if extension == ".js" || extension == ".ts" { | ||
path = path[0..path.len() - 3].to_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.
the Path/PathBuf types have utilities for extracting the extension, let's use those? there is also the camino crate, which is basically utf8-only versions of Path/PathBuf which might help since the string is already utf8.
-- @josephsavona (internal review)
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 tsx
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 #4303
@captbaritone has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
…erated code (#4057) Summary: # What does this PR do * This PR, imported from github, scrubs `.ts` extensions from filepaths in imports in generated typescript files * Typescript does not like `.ts`: microsoft/TypeScript#37582 In the typegen for Typescript when we're writing the pathname for module and type imports, this PR strips any trailing `.ts` that might exist on the path. This is required for TypeScript file imports which don't like the trailing file suffix. This was partially fixed in #4002 but not completely. Pull Request resolved: #4057 Test Plan: 👀 Reviewed By: alunyov Differential Revision: D39437828 Pulled By: rbalicki2 fbshipit-source-id: 53b3f5f7e467cefbc9ae73bf455ca040ea8a69aa
Fixes #3989 (comment)
This PR updates
relay-codegen
's printer not to include the file's extension when writing imports / requires. This might be a naive implementation, maybe there's a better, more holistic approach.