@kbach/react 0.6.6 → 0.6.7

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 CHANGED
@@ -73,6 +73,8 @@ export default defineConfig({
73
73
  });
74
74
  ```
75
75
 
76
+ Adding the plugin also declares `@kbach/react` in Vite's `optimizeDeps.include` upfront, so Vite pre-bundles it during its initial dependency scan instead of discovering it lazily on the first page that imports it — avoiding a forced full-reload mid-render, which is what a rare "Invalid hook call"-style crash on first load (but never again after) usually turns out to be.
77
+
76
78
  Then create an empty `kbach.css` anywhere in your project and import it once in your app entry:
77
79
 
78
80
  ```css
@@ -3360,6 +3360,21 @@ function kbach(userConfigOrOptions) {
3360
3360
  return {
3361
3361
  name: "kbach",
3362
3362
  enforce: "pre",
3363
+ // Without this, Vite only discovers @kbach/react needs pre-bundling once it
3364
+ // actually crawls into an import of it — typically the FIRST page load — and
3365
+ // has to stop, optimize it, and force a full reload mid-render. That reload
3366
+ // can land in the middle of a render pass (React hooks resolving against a
3367
+ // module graph that's being swapped out from under it), which is what an
3368
+ // "Invalid hook call" / hook-related crash on first load only usually is.
3369
+ // Declaring it here upfront means Vite pre-bundles it during its initial
3370
+ // dependency scan, before any page ever requests it — no mid-render reload.
3371
+ config() {
3372
+ return {
3373
+ optimizeDeps: {
3374
+ include: ["@kbach/react", "@kbach/react/jsx-runtime", "@kbach/react/jsx-dev-runtime"]
3375
+ }
3376
+ };
3377
+ },
3363
3378
  configResolved(resolved) {
3364
3379
  root = resolved.root;
3365
3380
  const names = new Set(resolved.plugins.map((p) => p.name));
@@ -3326,6 +3326,21 @@ function kbach(userConfigOrOptions) {
3326
3326
  return {
3327
3327
  name: "kbach",
3328
3328
  enforce: "pre",
3329
+ // Without this, Vite only discovers @kbach/react needs pre-bundling once it
3330
+ // actually crawls into an import of it — typically the FIRST page load — and
3331
+ // has to stop, optimize it, and force a full reload mid-render. That reload
3332
+ // can land in the middle of a render pass (React hooks resolving against a
3333
+ // module graph that's being swapped out from under it), which is what an
3334
+ // "Invalid hook call" / hook-related crash on first load only usually is.
3335
+ // Declaring it here upfront means Vite pre-bundles it during its initial
3336
+ // dependency scan, before any page ever requests it — no mid-render reload.
3337
+ config() {
3338
+ return {
3339
+ optimizeDeps: {
3340
+ include: ["@kbach/react", "@kbach/react/jsx-runtime", "@kbach/react/jsx-dev-runtime"]
3341
+ }
3342
+ };
3343
+ },
3329
3344
  configResolved(resolved) {
3330
3345
  root = resolved.root;
3331
3346
  const names = new Set(resolved.plugins.map((p) => p.name));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kbach/react",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
4
4
  "description": "React / React Native components and hooks for the Kbach framework",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./dist/index.js",