denoland/deno · error

Enable the deno_ast feature to get module export analysis.

Error message

Enable the deno_ast feature to get module export analysis.

What it means

The CJS export analyzer in Deno's resolver libraries has a stub implementation (NotImplementedModuleExportAnalyzer) that is selected when the crate is built without the deno_ast feature. Any attempt to analyze CommonJS module exports through the stub panics instead of returning an error.

Source

Thrown at libs/resolver/cjs/analyzer/mod.rs:153

  fn parse_module(
    &self,
    specifier: Url,
    media_type: MediaType,
    source: ArcStr,
  ) -> Result<Box<dyn ModuleForExportAnalysis>, JsErrorBox>;
}

/// A module export analyzer that will error when parsing a module.
pub struct NotImplementedModuleExportAnalyzer;

impl ModuleExportAnalyzer for NotImplementedModuleExportAnalyzer {
  fn parse_module(
    &self,
    _specifier: Url,
    _media_type: MediaType,
    _source: ArcStr,
  ) -> Result<Box<dyn ModuleForExportAnalysis>, JsErrorBox> {
    panic!("Enable the deno_ast feature to get module export analysis.");
  }
}

#[allow(clippy::disallowed_types, reason = "definition")]
pub type DenoCjsCodeAnalyzerRc<TSys> =
  deno_maybe_sync::MaybeArc<DenoCjsCodeAnalyzer<TSys>>;

type MemberPropsMap = BTreeMap<String, Vec<String>>;

#[allow(clippy::disallowed_types, reason = "definition")]
type MemberPropsCache = deno_maybe_sync::MaybeArc<
  MaybeDashMap<(Url, u64), deno_maybe_sync::MaybeArc<MemberPropsMap>>,
>;

/// Whether a source should skip CJS export analysis (treated as ESM) instead of
/// being parsed for `module.exports`/`require`.
///
/// Non-script files can't carry CJS exports. The file extension answers this for

View on GitHub (pinned to 9ad36f7a2c)

Solutions

  1. Enable the deno_ast feature on the resolver crate in Cargo.toml
  2. Restore default features if you actually need CJS export analysis
  3. Alternatively, supply your own ModuleExportAnalyzer implementation through the API that accepts one

Example fix

# before
# Cargo.toml
deno_resolver = { version = "...", default-features = false }

# after
deno_resolver = { version = "...", default-features = false, features = ["deno_ast"] }
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: A downstream crate depends on the resolver crates with default-features = false (no deno_ast), then loads a CommonJS module whose exports must be analyzed for require/import interop.

Common situations: Slimming builds by disabling default cargo features; version bumps that rewired feature selection; tools like dnt or custom embedders that only exercise CJS analysis at runtime.

Related errors


AI-assisted analysis of denoland/deno@9ad36f7a2c (2026-08-20). Data as JSON: /api/errors/6eaddac5aabe2741. Report an issue: GitHub.