@sentinel-js/react 0.1.2 → 0.1.3
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/README.md +1 -24
- package/package.json +2 -1
package/README.md
CHANGED
|
@@ -14,30 +14,7 @@ pnpm add @sentinel-js/react
|
|
|
14
14
|
|
|
15
15
|
**Peer dependencies:** `react` and `react-dom` (>=16.8.0). You must have them installed in your app.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
Add the following to your `vite.config.ts` to ensure a single React instance:
|
|
20
|
-
|
|
21
|
-
```typescript
|
|
22
|
-
import { defineConfig } from 'vite';
|
|
23
|
-
import react from '@vitejs/plugin-react';
|
|
24
|
-
import sentinelPlugin from '@sentinel-js/vite-plugin';
|
|
25
|
-
|
|
26
|
-
export default defineConfig({
|
|
27
|
-
plugins: [
|
|
28
|
-
react(),
|
|
29
|
-
sentinelPlugin(),
|
|
30
|
-
],
|
|
31
|
-
resolve: {
|
|
32
|
-
dedupe: ['react', 'react-dom'],
|
|
33
|
-
},
|
|
34
|
-
optimizeDeps: {
|
|
35
|
-
include: ['@sentinel-js/react'],
|
|
36
|
-
},
|
|
37
|
-
});
|
|
38
|
-
```
|
|
39
|
-
|
|
40
|
-
Without `dedupe` and `optimizeDeps.include`, you may encounter React hook errors in development mode.
|
|
17
|
+
When you add `@sentinel-js/vite-plugin` to your Vite config, it automatically sets `resolve.dedupe` and `optimizeDeps.include` so a single React instance is used in both dev and build. No extra config is required.
|
|
41
18
|
|
|
42
19
|
## Usage
|
|
43
20
|
|