Skip to content

Commit

Permalink
Make InvalidImportResolvePlugin a BeforeResolvePlugin
Browse files Browse the repository at this point in the history
vercel/turborepo#8165 introduced plugins that operate before resolving occurs, meaning that plugins like `InvalidImportResolvePlugin` which never use the initial resolve result and report issues can avoid that work.

Test Plan: `TURBOPACK_DEV=1 TURBOPACK=1 pnpm test-dev test/development/acceptance-app/invalid-imports.test.ts`
  • Loading branch information
wbinnssmith committed Jun 11, 2024
1 parent 16caf41 commit f195a8d
Show file tree
Hide file tree
Showing 7 changed files with 95 additions and 97 deletions.
74 changes: 37 additions & 37 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ swc_core = { version = "0.92.5", features = [
testing = { version = "0.35.25" }

# Turbo crates
turbopack-binding = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240610.2" }
turbopack-binding = { git = "https://github.com/vercel/turbo.git", branch = "wbinnssmith/before-resolve-module" }
# [TODO]: need to refactor embed_directory! macro usages, as well as resolving turbo_tasks::function, macros..
turbo-tasks = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240610.2" }
turbo-tasks = { git = "https://github.com/vercel/turbo.git", branch = "wbinnssmith/before-resolve-module" }
# [TODO]: need to refactor embed_directory! macro usage in next-core
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", tag = "turbopack-240610.2" }
turbo-tasks-fs = { git = "https://github.com/vercel/turbo.git", branch = "wbinnssmith/before-resolve-module" }

# General Deps

Expand Down
6 changes: 4 additions & 2 deletions packages/next-swc/crates/next-core/src/next_client/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,14 @@ pub async fn get_client_resolve_options_context(
resolved_map: Some(next_client_resolved_map),
browser: true,
module: true,
before_resolve_plugins: vec![Vc::upcast(NextFontLocalResolvePlugin::new(project_path))],
before_resolve_plugins: vec![
Vc::upcast(get_invalid_server_only_resolve_plugin(project_path)),
Vc::upcast(NextFontLocalResolvePlugin::new(project_path)),
],
after_resolve_plugins: vec![
Vc::upcast(ModuleFeatureReportResolvePlugin::new(project_path)),
Vc::upcast(UnsupportedModulesResolvePlugin::new(project_path)),
Vc::upcast(NextSharedRuntimeResolvePlugin::new(project_path)),
Vc::upcast(get_invalid_server_only_resolve_plugin(project_path)),
],
..Default::default()
};
Expand Down
Loading

0 comments on commit f195a8d

Please sign in to comment.