-
Notifications
You must be signed in to change notification settings - Fork 12.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
support jsxExtName for react-native project #9864
Conversation
Hi @yiminghe, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
@@ -2293,12 +2293,12 @@ namespace ts { | |||
if (options.jsx === JsxEmit.Preserve) { | |||
if (isSourceFileJavaScript(sourceFile)) { | |||
if (fileExtensionIs(sourceFile.fileName, ".jsx")) { | |||
extension = ".jsx"; | |||
extension = options.jsxExtName || ".jsx"; |
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.
This means that the user has to remember to add the dot in the extension name. I'm not necessarily sure whether that's desirable.
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.
This conform to path.extname, want to add a check?
if(extension.charAt(0)!=='.'){
extension = '.'+ extension;
}
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.
That'd probably be the most user-friendly thing, though @mhegazy could answer better.
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.
@mhegazy can you take a look at this? we as both react-native and typescript users need this
Ok, as long as it can cover my use case. |
another inconvenience, unlike react-web, in react-native's own packager
will be transformed to React.createElement(Text, null, '\uabcd'); and typescript will be transformed to (like babel) React.createElement(Text, null, '&#abcd;'); make it unable to use font icon, so we have to write
|
@yiminghe that seems like a React Native bug, surely? |
@RyanCavanaugh it is not react-native bug, $#xxxx; is html entity, it's fine in web, but react-native needs its unescaped raw value(\uxxxx) |
Superseded by #13636 |
related to: #8529 and facebook/react-native#5233 (comment)
current situation for react-native project:
want to make extension name configurable, use 'preserve' and get .js file.