Skip to content

Detect package name mismatch #7604

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions rewatch/src/build/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,7 @@ fn get_dependency_paths(
let package_name = dependent_package.name();
let dependency_path = if let Some(packages) = packages {
packages
// package name (from rescript.json) is used here.
.get(package_name)
.as_ref()
.map(|package| package.path.clone())
Expand Down
14 changes: 13 additions & 1 deletion rewatch/src/build/packages.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,8 +422,20 @@ fn make_package(config: config::Config, package_path: &Path, is_pinned_dep: bool
};

let package_name = read_package_name(package_path).expect("Could not read package name");
if package_name != config.name {
log::warn!(
"\nPackage name mismatch:\n\
- package.json name: {}\n\
- rescript.json name: {}\n\
This inconsistency might cause issues with package resolution.\n",
package_name,
config.name,
);
}

Package {
name: package_name,
// Reuse name from rescript.json instead.
name: config.name.clone(),
config: config.to_owned(),
source_folders,
source_files: None,
Expand Down
Loading