dce-edge

Guard edge-runtime code with DCE-safe conditional require patterns in Next.js.

Updated Apr 14, 2026
One-click install
npx skills add https://github.com/JuanDiego30/cermont_aplicativo --skill dce-edge-juandiego30
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dce-edge
Source: https://github.com/JuanDiego30/cermont_aplicativo/tree/main/.agents/skills/dce-edge
Command: npx skills add https://github.com/JuanDiego30/cermont_aplicativo --skill dce-edge-juandiego30

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

DCE-edge provides guidance to ensure dead-code elimination by using DCE-safe require patterns and edge-runtime constraints when mixing Node and web imports in edge builds.

Core Features & Use Cases

  • DCE-safe require patterns: guides conditional requires that webpack can dead-code-eliminate.
  • Compile-time routing: uses a single switcher to select between node vs web imports to keep bundles lean and predictable.
  • Edge runtime guidance: helps avoid Node-only APIs on the edge and documents best practices for define-env.ts.
  • Codebase hygiene: reduces runtime errors by guarding imports and clarifying import paths.

Quick Start

Implement a compile-time guarded require pattern for edge builds.

Frequently Asked Questions about dce-edge

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I prevent Node-only imports from breaking my Next.js edge runtime build?

To prevent Node-only imports from breaking edge runtime builds, apply DCE-safe require patterns using if/else-based conditional loading and DefinePlugin-gated paths. This enforces compile-time routing between edge and web environments for safe bundling.

What is a DCE-safe require pattern in webpack for edge runtimes?

A DCE-safe require pattern structures conditional branches so webpack can dead-code-eliminate unused Node imports. It uses a single compile-time switcher to select between Node and web imports, keeping edge runtime bundles lean and predictable.

Can I use conditional require to route Node vs web imports in Next.js edge builds?

Yes, conditional require can route Node versus web imports in Next.js edge builds. The Skill guides if/else-based conditional loading with DefinePlugin-gated paths, ensuring webpack safely eliminates Node-only code and clarifies when to inline requires.

Why does webpack include Node-only modules in my edge runtime bundle?

Webpack includes Node-only modules because standard dynamic imports are not DCE-safe. Applying DCE-safe require patterns with DefinePlugin environment gates allows webpack to dead-code-eliminate the Node paths and prevent edge runtime errors.

What's the best way to configure define-env for edge versus web environments?

The best way to configure define-env is to document recommended patterns for edge-versus-web environments using a single switcher. This clarifies import paths and reduces runtime errors by enforcing compile-time guarded require patterns for edge builds.

When should I not use conditional require branches for edge runtime imports?

Avoid conditional require branches when standard static imports suffice or when code does not mix Node and web APIs. DCE-safe require patterns are specifically for compile-time routing across edge and web builds where dead-code-elimination is required.