This package is going to be archived: Cause effector v22 doesn't require to have a domain to fork
Do not depend on this package in your libraries!
Sometimes we developed our apps and just afterwards start thinking about SSR and testing. For these purposes any effector app need to have root domain.
Usually we just manually update declarations. For example, from createEvent to rootDomain.createEvent. It takes time. effector-root provides you the possibility to have all units attached to the root domain without any manual actions.
-
Replace all imports of
effectortoeffector-root. You can do it by yourself or with babel plugin -
To retrieve our app root domain we need just to import it.
import { root, createEvent, attach, fork } from 'effector-root';Replace all imports of effector to effector-root/macro to automatically add sid:
import { root, createEvent, attach, fork } from 'effector-root/macro';Note: babel-plugin-macros do not support
import * as name, so Your importimport * as effector from 'effector-root/macrowon't work
You can easily use effector/compat in your application with effector-root, just:
import { root, createEvent, attach, fork } from 'effector-root/compat';Note:
rootdomain fromeffector-root/compatis not the same domain as fromeffector-root
- Install babel-plugin-module-resolver
- Add to plugins:
['module-resolver', { alias: { effector: 'effector-root' } } ]