abcnews / aunty

A toolkit for working with ABC News projects
https://www.npmjs.com/package/@abcnews/aunty
MIT License
32 stars 5 forks source link

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

Open phocks opened 1 year ago

phocks commented 1 year ago

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 commented 1 year ago

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

phocks commented 1 year ago

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} />);
      });
    }
  });
}
drzax commented 1 year ago

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