mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
feat(node): stabilize detecting if CJS via "type": "commonjs"
in a package.json (#26439)
This will respect `"type": "commonjs"` in a package.json to determine if `.js`/`.jsx`/`.ts`/.tsx` files are CJS or ESM. If the file is found to be ESM it will be loaded as ESM though.
This commit is contained in:
parent
6a4c6d83ba
commit
f091d1ad69
119 changed files with 1244 additions and 616 deletions
|
@ -15,8 +15,8 @@ use crate::errors::CanonicalizingPkgJsonDirError;
|
|||
use crate::errors::ClosestPkgJsonError;
|
||||
use crate::errors::PackageJsonLoadError;
|
||||
|
||||
// todo(dsherret): this isn't exactly correct and we should change it to instead
|
||||
// be created per worker and passed down as a ctor arg to the pkg json resolver
|
||||
// it would be nice if this was passed down as a ctor arg to the package.json resolver,
|
||||
// but it's a little bit complicated to do that, so we just maintain a thread local cache
|
||||
thread_local! {
|
||||
static CACHE: RefCell<HashMap<PathBuf, PackageJsonRc>> = RefCell::new(HashMap::new());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue