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

Please update document about jsx-pragma with esbuild. #2115

Closed
PeterlitsZo opened this issue Feb 7, 2022 · 3 comments
Closed

Please update document about jsx-pragma with esbuild. #2115

PeterlitsZo opened this issue Feb 7, 2022 · 3 comments
Labels
documentation Changes only affect the documentation

Comments

@PeterlitsZo
Copy link
Contributor

PeterlitsZo commented Feb 7, 2022

We are using vite, which use esbuild to deal with all source files(It will remove typescript keywords and so on to make it as a javascript but without typecheck). vite's document tell us how to enable esbuild's option --- But we have no idea that what need I do.

Here is documents we find:

We'd like to help you and give you a PR. but... We do not know how to make it...

After some hours, we made it!!!!!! For vite!!!!

// vite.config.js
import { defineConfig } from 'vite';

export default defineConfig({
  esbuild: {
    jsxFactory: 'jsx',
    jsxInject: `import { jsx } from 'theme-ui'`,
  },
});

It will use jsx to build component. And add import { jsx } from 'theme-ui' for every file that using JSX!!!

We'd like to update the document and give you a PR. would you want it?

@hasparus hasparus added the enhancement New feature or request label Feb 7, 2022
@hasparus
Copy link
Member

hasparus commented Feb 7, 2022

We'd like to update the document and give you a PR. would you want it?

That would be a very nice addition to the docs. :)

@hasparus
Copy link
Member

hasparus commented Feb 7, 2022

Here's the MDX file responsible for JSX pragma docs: https://github.com/system-ui/theme-ui/blob/develop/packages/docs/src/pages/guides/jsx-pragma.mdx

You should be able to edit it from GitHub UI even without cloning the repo :)

@hasparus hasparus added documentation Changes only affect the documentation and removed enhancement New feature or request labels Feb 7, 2022
@PeterlitsZo
Copy link
Contributor Author

Thanks. I give you a PR. Please check.

PeterlitsZo added a commit to ACMHomepage/ACMHomepage-prev that referenced this issue Feb 11, 2022
…stem.

We add theme-ui, and config it because it has its own jsx. See [vite-jsx][] for
more infomation. So we change `package.json`, `yarn.lock`,
`tsconfig.json` and add file `vite.config.js`.

To use `theme-ui`, we add `anotherTheme.ts` (there is already `theme.ts` for
styled-component, we will try to remove it soon). And we change
`index.jsx` to use the theme.

Then we make `Dots` use theme-ui and change `Carousel` (because it use
`Dots`).

[vite-jsx]: system-ui/theme-ui#2115.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Changes only affect the documentation
Projects
None yet
Development

No branches or pull requests

2 participants