What problem does it solve?
Edge-runtime development often requires careful orchestration of conditional imports and node-only modules to keep builds valid for both edge and web targets. This skill provides proven patterns to safely gate require() calls and guard environment-specific code.
Core Features & Use Cases
- DCE-Safe import patterns: use conditional requires and DefinePlugin-friendly branches to allow webpack/turbopack to prune unused paths.
- TypeScript safety and edge-vs-web gating: ensure definite assignment and correct imports depending on runtime.
- Compile-time switchers: create a single switcher module that loads .node or .web variants based on environment.
- Edge-runtime constraints awareness: guard node:* imports and environment-based flags to support edge routes.
Quick Start
Use this skill to implement edge-safe require patterns by wrapping Node imports with conditional guards so edge builds compile cleanly and web builds stay free of Node-only dependencies.