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

Add .jsx and .tsx support (Edit: .tsx is already supported) #200

Open
phocks opened this issue Apr 11, 2023 · 3 comments
Open

Add .jsx and .tsx support (Edit: .tsx is already supported) #200

phocks opened this issue Apr 11, 2023 · 3 comments
Labels

Comments

@phocks
Copy link
Member

phocks commented Apr 11, 2023

It seems to be becoming a standard now that any JavaScript and TypeScript files that contain JSX syntax have the full .jsx or .tsx so I'm suggesting we update our React and Preact templates to use these filenames and add import support to WebPack (I don't think it handles these file types currently).

@drzax
Copy link
Member

drzax commented Apr 11, 2023

I thought they were already? https://github.com/abcnews/aunty/blob/main/src/generators/project/templates/react/src/components/App/index.tsx

@phocks
Copy link
Member Author

phocks commented Apr 11, 2023

Ahh yes my mistake .tsx seems to be implemented, but not .jsx

Probably not overly urgent, but .jsx support could be sort of easy to implement

I also noticed a strange bug where if you generate a project and NOT choose TypeScript it adds this in your index.js file which includes : any which is typescript. Small bug, I'll track it down and open another issue.

if (module.hot) {
  module.hot.accept('./components/App', () => {
    try {
      renderApp();
    } catch (err: any) {
      import('./components/ErrorBox').then(({ default: ErrorBox }) => {
        root.render(<ErrorBox error={err} />);
      });
    }
  });
}

@phocks phocks changed the title Add .jsx and .tsx support Add .jsx and .tsx support (Edit: .tsx is already supported) Apr 11, 2023
@drzax
Copy link
Member

drzax commented Apr 11, 2023

Yeah, so you'd just rename with the new extension if isTS is false? Sounds like a good idea to me.

@abcnews abcnews deleted a comment Jun 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants