Commit b94f4f2
committed
refactor(useTriggerChat): remove Node.js-specific runtime dependency check
Remove require.resolve() runtime check for optional peer dependencies.
With optional peerDependencies in package.json, static ES imports provide
better compile-time validation:
- Build fails with clear errors only if useTriggerChat is imported
- TypeScript/LSP shows missing dependencies immediately in IDE
- Tree-shaking eliminates code when hook is unused
- No Node.js-specific APIs in client-side "use client" code
The previous runtime check using require.resolve() was:
1. Not isomorphic (fails in browser/bundler environments)
2. Redundant (static imports already enforce dependencies)
3. Worse UX (runtime errors instead of build-time errors)1 parent 136085f commit b94f4f2
1 file changed
+0
-34
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
490 | 490 | | |
491 | 491 | | |
492 | 492 | | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
498 | | - | |
499 | | - | |
500 | | - | |
501 | | - | |
502 | | - | |
503 | | - | |
504 | | - | |
505 | | - | |
506 | | - | |
507 | | - | |
508 | | - | |
509 | | - | |
510 | | - | |
511 | | - | |
512 | | - | |
513 | | - | |
514 | | - | |
515 | | - | |
516 | | - | |
517 | | - | |
518 | | - | |
519 | | - | |
520 | | - | |
521 | | - | |
522 | | - | |
523 | | - | |
524 | | - | |
525 | | - | |
526 | 493 | | |
527 | 494 | | |
528 | 495 | | |
| |||
610 | 577 | | |
611 | 578 | | |
612 | 579 | | |
613 | | - | |
614 | 580 | | |
615 | 581 | | |
616 | 582 | | |
| |||
0 commit comments