diff --git a/apps/website/docs/factories/index.md b/apps/website/docs/factories/index.md index 9bfa292b..2888549c 100644 --- a/apps/website/docs/factories/index.md +++ b/apps/website/docs/factories/index.md @@ -6,7 +6,7 @@ outline: [2, 3] In Effector's world any factory is a function that returns a set of [_Stores_](https://effector.dev/docs/api/effector/store), [_Events_](https://effector.dev/en/api/effector/event/) or [_Effects_](https://effector.dev/docs/api/effector/effect). It's a way to encapsulate some logic and reuse it in different places. -If your application has any unit-tests or meant to be rendered on the server (SSR) factories have to be added to `factories` field in config of [`effector/babel-plugin`](https://effector.dev/docs/api/effector/babel-plugin/) or [`@effector/swc-plugin`](https://github.com/effector/swc-plugin). The reasons of this limitation are described in [this article](https://farfetched.pages.dev/recipes/sids.html). +If your application has any unit-tests or meant to be rendered on the server (SSR) factories have to be added to `factories` field in config of [`effector/babel-plugin`](https://effector.dev/docs/api/effector/babel-plugin/) or [`@effector/swc-plugin`](https://effector.dev/en/api/effector/swc-plugin/). The reasons of this limitation are described in [this article](https://effector.dev/en/explanation/sids/). In real world it is easy to add any third-party library that uses factories to the config because it has an exact import path. But adding factories from your own code is a bit more complicated. There are no automatic ways to validate that all factories are added to the config. This library is solving this problem: just add `@withease/factories` to the config and use it to create and invoke factories. @@ -32,28 +32,7 @@ npm install @withease/factories ::: -Second, you need to add `@withease/factories` to the config of [`effector/babel-plugin`](https://effector.dev/docs/api/effector/babel-plugin/) or [`@effector/swc-plugin`](https://github.com/effector/swc-plugin): - -::: code-group - -```json [effector/babel-plugin] -{ - "plugins": [["effector/babel-plugin"]] -} -``` - -```json [@effector/swc-plugin] -{ - "$schema": "https://json.schemastore.org/swcrc", - "jsc": { - "experimental": { - "plugins": [["@effector/swc-plugin"]] - } - } -} -``` - -::: +Second, you need to setup [`effector/babel-plugin`](https://effector.dev/docs/api/effector/babel-plugin/) or [`@effector/swc-plugin`](https://effector.dev/en/api/effector/swc-plugin/). Please follow the instructions in the corresponding documentation. That's it! Now you can use `@withease/factories` to create and invoke factories across your application. diff --git a/apps/website/docs/factories/motivation.md b/apps/website/docs/factories/motivation.md index dbd4bbbe..cc77f688 100644 --- a/apps/website/docs/factories/motivation.md +++ b/apps/website/docs/factories/motivation.md @@ -9,7 +9,7 @@ Let us elaborate on these problems. ## Controlling that factories are invoked correctly -In Effector's ecosystem, all factories [have to be added to the code-transformation plugin's config](https://farfetched.pages.dev/recipes/sids.html). But it is really easy to forget to add a factory to the config after creating it. Effector's plugin will not throw an error in this case, but the factory will not work correctly in case of SSR. +In Effector's ecosystem, all factories [have to be added to the code-transformation plugin's config](https://effector.dev/en/explanation/sids/). But it is really easy to forget to add a factory to the config after creating it. Effector's plugin will not throw an error in this case, but the factory will not work correctly in case of SSR. In case of using this library, you have to remember only one thing: all factories have to be created using `createFactory` function from `@withease/factories` library. The result of this function is not callable, so you will get an error if you try to invoke it directly.