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

support jsxExtName for react-native project #9864

Closed
wants to merge 1 commit into from
Closed

support jsxExtName for react-native project #9864

wants to merge 1 commit into from

Conversation

yiminghe
Copy link

@yiminghe yiminghe commented Jul 21, 2016

related to: #8529 and facebook/react-native#5233 (comment)

current situation for react-native project:

  • if use 'react', get .js file, then it will transform jsx and hard to debug.
  • if use 'preserve', get .jsx file, then react-native does not support it.

want to make extension name configurable, use 'preserve' and get .js file.

@msftclas
Copy link

Hi @yiminghe, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution!
You've already signed the contribution license agreement. Thanks!
We will now validate the agreement and then real humans will evaluate your PR.

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";
Copy link
Member

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.

Copy link
Author

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;
}

Copy link
Member

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.

Copy link
Author

@yiminghe yiminghe Jul 26, 2016

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

@mhegazy mhegazy self-assigned this Sep 14, 2016
@mhegazy
Copy link
Contributor

mhegazy commented Sep 26, 2016

@yiminghe can we change this to use the proposal in #11158?

@yiminghe
Copy link
Author

Ok, as long as it can cover my use case.

@yiminghe
Copy link
Author

yiminghe commented Oct 26, 2016

another inconvenience, unlike react-web, in react-native's own packager

<Text>&#abcd;</Text>

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

<Text>{'\uabcd'}</Text>

@RyanCavanaugh
Copy link
Member

@yiminghe that seems like a React Native bug, surely?

@yiminghe
Copy link
Author

@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)

@mhegazy
Copy link
Contributor

mhegazy commented Jan 24, 2017

Superseded by #13636

@mhegazy mhegazy closed this Jan 24, 2017
@microsoft microsoft locked and limited conversation to collaborators Jun 19, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants