From f343391a9f97d29ad287f247c06aa370eb7cab50 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Thu, 17 Aug 2023 12:14:22 -0400 Subject: fix(unstable): disable importing from the vendor directory (#20067) Some people might get think they need to import from this directory, which could cause confusion and duplicate dependencies. Additionally, the `vendor` directory has special behaviour in the language server, so importing from the folder will definitely cause confusion and issues there. --- cli/lsp/documents.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'cli/lsp') diff --git a/cli/lsp/documents.rs b/cli/lsp/documents.rs index 439cf547d..8227d2e4c 100644 --- a/cli/lsp/documents.rs +++ b/cli/lsp/documents.rs @@ -21,6 +21,7 @@ use crate::npm::CliNpmRegistryApi; use crate::npm::NpmResolution; use crate::npm::PackageJsonDepsInstaller; use crate::resolver::CliGraphResolver; +use crate::resolver::CliGraphResolverOptions; use crate::util::glob; use crate::util::path::specifier_to_file_path; use crate::util::text_encoding; @@ -1241,13 +1242,19 @@ impl Documents { Arc::new(PackageJsonDepsProvider::new(maybe_package_json_deps)); let deps_installer = Arc::new(PackageJsonDepsInstaller::no_op()); self.resolver = Arc::new(CliGraphResolver::new( - maybe_jsx_config, - options.maybe_import_map, - false, options.npm_registry_api, options.npm_resolution, deps_provider, deps_installer, + CliGraphResolverOptions { + maybe_jsx_import_source_config: maybe_jsx_config, + maybe_import_map: options.maybe_import_map, + maybe_vendor_dir: options + .maybe_config_file + .and_then(|c| c.vendor_dir_path()) + .as_ref(), + no_npm: false, + }, )); self.imports = Arc::new( if let Some(Ok(imports)) = -- cgit v1.2.3