You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: packages/react-renderer-demo/src/pages/optimization.md
+23-29Lines changed: 23 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,55 +4,48 @@ import DocPage from '@docs/doc-page';
4
4
5
5
# Optimization
6
6
7
-
Data Driven Forms is built in three module formats: CJS, ESM and UMD.
7
+
Data Driven Forms is built in two module formats: CJSand ESM.
8
8
9
-
## CJS
9
+
By using a standard import path, **the module based on your environment will be used**. Browser environments are using ESM modules, environments based on NodeJS (testing) are using CJS.
10
+
11
+
## Import only specific file
12
+
13
+
Exported files follow the kebab case. All components are exported in default exports.
In both of CJS and ESM, exported files follow the kebab case. All components are exported in default exports.
26
-
27
27
## UMD
28
28
29
-
**Recommendation: UMD is just a fallback option. We strongly recommend to use CJS or ESM. These two modules allow to better optimization via treeshaking and more modern language syntax.**
Only the `FormRenderer` component is exported as a default. In all other packages, use only named exports.
29
+
UMD module format is no longer supported.
37
30
38
31
---
39
32
40
33
## Mixing imports
41
34
42
-
**Do not mix** different module formats (for example `Renderer` imported from UMD and `componentMapper` from CJS), otherwise you will encounter this error:
35
+
**Do not mix** different module formats (for example `Renderer` imported from ESM and `componentMapper` from CJS), otherwise you will encounter this error:
43
36
44
37
`useField must be used inside of a <Form> component`
45
38
46
39
## Transforming imports in Babel
47
40
48
-
You can automate tranforming imports to specific module formats by using [transform-imports](https://www.npmjs.com/package/babel-plugin-transform-imports) plugin in your Babel configuration. With that, you don't need to write explicit imports manually and you can still import everything from projects' roots.
41
+
You can automate tranforming imports by using [transform-imports](https://www.npmjs.com/package/babel-plugin-transform-imports) plugin in your Babel configuration. With that, you don't need to write explicit imports manually and you can still import everything from projects' roots.
0 commit comments