Skip to content
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

feat(es/module): Improve error message about relative jsc.baseUrl #7827

Merged
merged 2 commits into from
Aug 17, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions crates/swc_ecma_transforms_module/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,14 @@ where
if let Some(base_dir) = &base_dir {
assert!(
base_dir.is_absolute(),
"base_dir({}) must be absolute. Please ensure that `jsc.baseUrl` is specified \
correctly.",
"base_dir(`{}`) must be absolute. Please ensure that `jsc.baseUrl` is specified \
correctly. This cannot be deduced by SWC itself because SWC is a transpiler and \
it does not try to resolve project details. In other works, SWC does not know \
which directory should be used as a base directory. It can be deduced if \
`.swcrc` is used, but if not, there are many candidates. e.g. the directory \
containing `package.json`, or the current working directory. Because of that, \
the caller (typically the developer of the JavaScript package) should specify \
it. If you see this error, please report an issue to the package author.",
base_dir.display()
);
}
Expand Down