Skip to content

Commit

Permalink
Replace custom SWC instructions by links to official documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkamyshev committed Aug 16, 2024
1 parent 952b522 commit 87af663
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 88 deletions.
55 changes: 1 addition & 54 deletions apps/website/docs/recipes/vite.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,60 +80,7 @@ export default defineConfig({
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:

::: code-group

```sh [pnpm]
pnpm add --save-dev unplugin-swc effector-swc-plugin @swc/core
```

```sh [yarn]
yarn add --dev unplugin-swc effector-swc-plugin @swc/core
```

```sh [npm]
npm install --dev unplugin-swc effector-swc-plugin @swc/core
```

:::

2. Add [`unplugin-swc`](https://github.com/egoist/unplugin-swc) and [`effector-swc-plugin`](https://github.com/kireevmp/effector-swc-plugin) to your config:

```ts
// vite.config.ts
import { defineConfig } from 'vite';
import swc from 'unplugin-swc';

export default defineConfig({
plugins: [
swc.vite({
jsc: {
experimental: {
plugins: ['effector-swc-plugin'],
},
},
}),
],
});
```

::: 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", {}]] });
],
});
```

:::
Due to the experimental status of SWC plugins, we do not provide a detailed guide on how to use SWC with Farfetched. However, you can find an instruction in the official documentation of [`@effector/swc-plugin`](https://effector.dev/en/api/effector/swc-plugin/).

## Disable HMR

Expand Down
35 changes: 1 addition & 34 deletions apps/website/docs/shared/sids_plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,40 +18,7 @@ Read more about `effector/babel-plugin` configuration in the [Effector's documen
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.
:::

[SWC](https://swc.rs) is a blazing fast alternative to Babel. If you are using it, you can install `effector-swc-plugin` to get the same DX as with Babel.

::: code-group

```sh [pnpm]
pnpm add --save-dev effector-swc-plugin @swc/core
```

```sh [yarn]
yarn add --dev effector-swc-plugin @swc/core
```

```sh [npm]
npm install --dev effector-swc-plugin @swc/core
```

:::

Now just modify your `.swcrc` config to enable installed plugin:

```json
{
"$schema": "https://json.schemastore.org/swcrc",
"jsc": {
"experimental": {
"plugins": ["effector-swc-plugin"]
}
}
}
```

:::info
Read more about `effector-swc-plugin` configuration in the [plugin documentation](https://github.com/kireevmp/effector-swc-plugin).
:::
If you are using [SWC](https://swc.rs), please read the official documentation of [`@effector/swc-plugin`](https://effector.dev/en/api/effector/swc-plugin/).

**Vite**

Expand Down

0 comments on commit 87af663

Please sign in to comment.