firebolt-dev / firebolt

The Simple React Framework
https://firebolt.dev
MIT License
128 stars 6 forks source link

Feature Request: Support JSX file #3

Closed jellydn closed 3 months ago

jellydn commented 5 months ago

Why

That's a common pattern that people would use .jsx for React components.

What

Support JSX filename

Possible solution

Instead of load .js on firebolt lib, we could search for .js*.

Reproduce:


> firebolt-grit-demo@0.3.1 dev
> firebolt dev

  🔥 Firebolt (v0.3.1)

 INF  building...
 ERR  BuildError: Could not resolve "../routes/_layout.js"

    .firebolt/lib.js:15:21:
    15 | import Document from '../routes/_layout.js'
       |                      ~~~~~~~~~~~~~~~~~~~~~~

 CHN  ~/.git/FETCH_HEAD
 INF  building...
 ERR  BuildError: Could not resolve "../routes/_layout.js"

    .firebolt/lib.js:15:21:
    15 | import Document from '../routes/_layout.js'
       |                      ~~~~~~~~~~~~~~~~~~~~~~
ashconnell commented 5 months ago

You only need to name your files .js because the JSX is automatically implied, since this is a React framework.

What benefit do you get from naming them .jsx?

jellydn commented 5 months ago

I guess you want to make it simple however you would want to support linter, e.g ESLint rule https://github.com/jsx-eslint/eslint-plugin-react/blob/master/docs/rules/jsx-filename-extension.md

Or support Biome

image

Works fine with .jsx filename

image
ashconnell commented 5 months ago

That’s fair. I should be able to add optional support for using that as an extension, at least for those who want it.

jellydn commented 5 months ago

That’s fair. I should be able to add optional support for using that as an extension, at least for those who want it.

Great. Thanks 🙏