Skip to content

Commit

Permalink
Update how-to for Vite
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkamyshev committed Sep 29, 2023
1 parent f9ba4c6 commit 28aa6c2
Showing 1 changed file with 22 additions and 1 deletion.
23 changes: 22 additions & 1 deletion apps/website/docs/recipes/vite.md
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,11 @@ export default defineConfig({

## SWC

> [SWC](https://swc.rs) is a blazing fast alternative to Babel.
[SWC](https://swc.rs) is a blazing fast alternative to Babel.

::: warning
Note that [plugins for SWC are experimental](https://github.com/swc-project/swc/discussions/3540) and may not work as expected. We recommend to stick with Babel for now.
:::

1. Install required dependencies:

Expand Down Expand Up @@ -114,6 +118,23 @@ export default defineConfig({
});
```

::: tip
If you are using [`@vitejs/plugin-react-swc`](https://github.com/vitejs/vite-plugin-react-swc) in your project, you do not need to add `unplugin-swc` to your config, because it is already included in `@vitejs/plugin-react-swc`. So, just modify your config to enable `@effector/swc-plugin`.

```ts
// vite.config.js
import { defineConfig } from 'vite';
import react from "@vitejs/plugin-react-swc";

export default defineConfig({
plugins: [
react({ plugins: [["@effector/swc-plugin", {}]] });
],
});
```

:::

## Disable HMR

Effector does not support HMR [yet](https://github.com/effector/effector/issues/674). So, it's better to disable HMR for now to avoid unexpected behavior.
Expand Down

0 comments on commit 28aa6c2

Please sign in to comment.