{"record":{"id":"6eaddac5aabe2741","repo":"denoland/deno","slug":"enable-the-deno-ast-feature-to-get-module-export-a","errorCode":null,"errorMessage":"Enable the deno_ast feature to get module export analysis.","messagePattern":"Enable the deno_ast feature to get module export analysis\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"libs/resolver/cjs/analyzer/mod.rs","lineNumber":153,"sourceCode":"  fn parse_module(\n    &self,\n    specifier: Url,\n    media_type: MediaType,\n    source: ArcStr,\n  ) -> Result<Box<dyn ModuleForExportAnalysis>, JsErrorBox>;\n}\n\n/// A module export analyzer that will error when parsing a module.\npub struct NotImplementedModuleExportAnalyzer;\n\nimpl ModuleExportAnalyzer for NotImplementedModuleExportAnalyzer {\n  fn parse_module(\n    &self,\n    _specifier: Url,\n    _media_type: MediaType,\n    _source: ArcStr,\n  ) -> Result<Box<dyn ModuleForExportAnalysis>, JsErrorBox> {\n    panic!(\"Enable the deno_ast feature to get module export analysis.\");\n  }\n}\n\n#[allow(clippy::disallowed_types, reason = \"definition\")]\npub type DenoCjsCodeAnalyzerRc<TSys> =\n  deno_maybe_sync::MaybeArc<DenoCjsCodeAnalyzer<TSys>>;\n\ntype MemberPropsMap = BTreeMap<String, Vec<String>>;\n\n#[allow(clippy::disallowed_types, reason = \"definition\")]\ntype MemberPropsCache = deno_maybe_sync::MaybeArc<\n  MaybeDashMap<(Url, u64), deno_maybe_sync::MaybeArc<MemberPropsMap>>,\n>;\n\n/// Whether a source should skip CJS export analysis (treated as ESM) instead of\n/// being parsed for `module.exports`/`require`.\n///\n/// Non-script files can't carry CJS exports. The file extension answers this for","sourceCodeStart":135,"sourceCodeEnd":171,"githubUrl":"https://github.com/denoland/deno/blob/9ad36f7a2cce60488e6ec52283efb32efddaf93a/libs/resolver/cjs/analyzer/mod.rs#L135-L171","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Enable the deno_ast feature on the resolver crate in Cargo.toml","Restore default features if you actually need CJS export analysis","Alternatively, supply your own ModuleExportAnalyzer implementation through the API that accepts one"],"exampleFix":"# before\n# Cargo.toml\ndeno_resolver = { version = \"...\", default-features = false }\n\n# after\ndeno_resolver = { version = \"...\", default-features = false, features = [\"deno_ast\"] }","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Audit `cargo tree -f \"{p} {f}\"` for the resolver crates' enabled features before shipping a build that touches CJS","Smoke-test loading one CommonJS module in CI for any binary built with default-features = false","Treat reaching NotImplementedModuleExportAnalyzer as a packaging bug, not a runtime condition to handle"],"tags":["cargo-features","cjs","module-analysis","build-config","panic"],"backgroundTag":"missing-feature-flag","analyzedSha":"9ad36f7a2cce60488e6ec52283efb32efddaf93a","analyzedAt":"2026-08-20T13:07:44.778Z","contentChangedAt":"2026-08-20T13:07:44.778Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}