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 support for React components. #18

Merged
merged 2 commits into from
Mar 23, 2021
Merged

Add support for React components. #18

merged 2 commits into from
Mar 23, 2021

Conversation

matthewp
Copy link
Contributor

This adds support for react components via a new extensions config in astro.config.mjs. In the future we can extend this to do things like look at the import statements, as Snowpack does.

This adds support for react components via a new `extensions` config in astro.config.mjs. In the future we can extend this to do things like look at the import statements, as Snowpack does.
@natemoo-re
Copy link
Member

Nice! Does this allow multi-part extensions like .preact.tsx and .react.tsx? Because that would make mixing similar frameworks pretty easy.

@matthewp
Copy link
Contributor Author

matthewp commented Mar 23, 2021

Not a the moment, no. That could be done in a follow-up PR. There's an idea that Snowpack perhaps could have some sort of API like:

snowpack.getMeta('components/Example.jsx') // { framework: 'react', url: '/components/Example.js' })

Which internally would do some things such as:

  1. Look at extensions config.
  2. Look at file extension.
  3. Look at import statements.

In some order of preference. I was hoping to avoid duplicating any code that might be better put into Snowpack.

@matthewp matthewp merged commit 854d0fe into main Mar 23, 2021
@matthewp matthewp deleted the react branch March 23, 2021 17:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants