mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 10:59:13 +00:00
fix(node): support re-exported esm modules in cjs export analysis (#28379)
Adds support for re-exporting an ES module from a CJS one and then importing the CJS module from ESM. Also fixes a bug where require esm wasn't working in deno compile.
This commit is contained in:
parent
0c0757fe66
commit
2292eb1c92
23 changed files with 366 additions and 166 deletions
6
cli/cache/node.rs
vendored
6
cli/cache/node.rs
vendored
|
@ -137,6 +137,8 @@ impl NodeAnalysisCacheInner {
|
|||
|
||||
#[cfg(test)]
|
||||
mod test {
|
||||
use deno_ast::ModuleExportsAndReExports;
|
||||
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
|
@ -148,10 +150,10 @@ mod test {
|
|||
.get_cjs_analysis("file.js", CacheDBHash::new(2))
|
||||
.unwrap()
|
||||
.is_none());
|
||||
let cjs_analysis = CliCjsAnalysis::Cjs {
|
||||
let cjs_analysis = CliCjsAnalysis::Cjs(ModuleExportsAndReExports {
|
||||
exports: vec!["export1".to_string()],
|
||||
reexports: vec!["re-export1".to_string()],
|
||||
};
|
||||
});
|
||||
cache
|
||||
.set_cjs_analysis("file.js", CacheDBHash::new(2), &cjs_analysis)
|
||||
.unwrap();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue