@colisweb/rescript-toolkit 2.26.0 → 2.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
package/src/mock/index.md
CHANGED
|
@@ -10,7 +10,36 @@ Install the package
|
|
|
10
10
|
yarn add msw --dev
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
### Wrap the App for dev only
|
|
14
|
+
|
|
15
|
+
```js
|
|
16
|
+
import React from "react";
|
|
17
|
+
import ReactDOM from "react-dom";
|
|
18
|
+
import "@colisweb/rescript-toolkit/src/ui/styles.css";
|
|
19
|
+
import { make as App } from "../lib/es6_global/src/App.bs";
|
|
20
|
+
import { make as Spinner } from "@colisweb/rescript-toolkit/lib/es6_global/src/ui/Toolkit__Ui_SpinnerFullScreen.bs.js";
|
|
21
|
+
import { make as AppWithMock } from "@colisweb/rescript-toolkit/lib/es6_global/src/mock/AppWithMock.bs";
|
|
22
|
+
|
|
23
|
+
const root = ReactDOM.createRoot(document.getElementById("root"));
|
|
24
|
+
|
|
25
|
+
if (import.meta.env.DEV) {
|
|
26
|
+
import("../lib/es6_global/mocks/Mock.bs").then(({ worker }) => {
|
|
27
|
+
root.render(
|
|
28
|
+
<AppWithMock worker={worker}>
|
|
29
|
+
<App />
|
|
30
|
+
</AppWithMock>
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
} else {
|
|
34
|
+
root.render(
|
|
35
|
+
<React.Suspense fallback={<Spinner />}>
|
|
36
|
+
<App />
|
|
37
|
+
</React.Suspense>
|
|
38
|
+
);
|
|
39
|
+
}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Define the mock
|
|
14
43
|
|
|
15
44
|
```rescript
|
|
16
45
|
/* Mock_Page_X.res */
|