mirror of
https://github.com/denoland/deno.git
synced 2025-08-04 02:48:24 +00:00
feat: support bare specifier resolution with package.json (#17864)
This commit enables resolution of "bare specifiers" (eg. "import express from 'express';") if a "package.json" file is discovered. It's a step towards being able to run projects authored for Node.js without any changes. With this commit we are able to successfully run Vite projects without any changes to the user code. --------- Co-authored-by: David Sherret <dsherret@gmail.com>
This commit is contained in:
parent
c18e0d1d37
commit
1c14127c4f
12 changed files with 63 additions and 26 deletions
|
@ -14,6 +14,7 @@ use crate::resolver::CliGraphResolver;
|
|||
use crate::tools::check;
|
||||
|
||||
use deno_core::anyhow::bail;
|
||||
use deno_core::anyhow::Context;
|
||||
use deno_core::error::custom_error;
|
||||
use deno_core::error::AnyError;
|
||||
use deno_core::ModuleSpecifier;
|
||||
|
@ -152,6 +153,10 @@ pub async fn create_graph_and_maybe_check(
|
|||
ps.file_fetcher.clone(),
|
||||
PermissionsContainer::allow_all(),
|
||||
PermissionsContainer::allow_all(),
|
||||
ps.options
|
||||
.resolve_local_node_modules_folder()
|
||||
.with_context(|| "Resolving local node_modules folder.")?
|
||||
.map(|path| ModuleSpecifier::from_file_path(path).unwrap()),
|
||||
);
|
||||
let maybe_imports = ps.options.to_maybe_imports()?;
|
||||
let maybe_package_json_deps = ps.options.maybe_package_json_deps()?;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue