Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
itsMapleLeaf committed Nov 16, 2023
1 parent 5b1051c commit 7bf11fa
Showing 1 changed file with 29 additions and 3 deletions.
32 changes: 29 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,42 @@ Use [babel macros](https://github.com/kentcdodds/babel-plugin-macros) in your [V
npm install --save-dev vite-plugin-babel-macros
```

Then, add it to `vite.config.js` or `vite.config.ts`:
Then, add it to your vite config:

```js
import macrosPlugin from "vite-plugin-babel-macros"
import macros from "vite-plugin-babel-macros"

export default {
// ...
plugins: [
// ...
macrosPlugin(),
macros(),
],
}
```

### Usage with `@vitejs/plugin-react`

Install `babel-plugin-macros`, then add the plugin to the react plugin options.

```sh
npm install --save-dev babel-plugin-macros
```

```js
import react from "@vitejs/plugin-react"
import macros from "vite-plugin-babel-macros"

export default {
// ...
plugins: [
// ...
react({
babel: {
plugins: ["babel-plugin-macros"],
},
}),
macros(),
],
}
```

0 comments on commit 7bf11fa

Please sign in to comment.