diff options
author | Bartek IwaĆczuk <biwanczuk@gmail.com> | 2022-10-01 22:21:19 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-01 22:21:19 +0200 |
commit | 048c06f84fe78742d6d9e64caa2aadcd212802a5 (patch) | |
tree | d678a4bf1ec7fbde32912d0cbce37eb1947cfb97 /cli/node/mod.rs | |
parent | a6618dc01c890363bdbcc5f689389cbca1e8fb75 (diff) |
fix(npm): handle json files in require (#16125)
Diffstat (limited to 'cli/node/mod.rs')
-rw-r--r-- | cli/node/mod.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/cli/node/mod.rs b/cli/node/mod.rs index 2e431eaa0..06d62269e 100644 --- a/cli/node/mod.rs +++ b/cli/node/mod.rs @@ -749,6 +749,14 @@ pub fn translate_cjs_to_esm( { return Ok(analysis); } + + if media_type == MediaType::Json { + return Ok(CjsAnalysis { + exports: vec![], + reexports: vec![], + }); + } + let parsed_source = deno_ast::parse_script(deno_ast::ParseParams { specifier: specifier.to_string(), text_info: deno_ast::SourceTextInfo::new(code.into()), |