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

[Feature]: improve diagnostic when resolve failed with missing resolve.extensions #5627

Closed
Tracked by #3459
h-a-n-a opened this issue Feb 6, 2024 · 3 comments · Fixed by #5680
Closed
Tracked by #3459

[Feature]: improve diagnostic when resolve failed with missing resolve.extensions #5627

h-a-n-a opened this issue Feb 6, 2024 · 3 comments · Fixed by #5680
Assignees
Labels
contrib: easy contrib: has guidance feat New feature or request PR welcome team The issue/pr is created by the member of Rspack.

Comments

@h-a-n-a
Copy link
Contributor

h-a-n-a commented Feb 6, 2024

What problem does this feature solve?

For example, if a module resolution is failed as I do import("./foo").
Then we will check the files in the current directory with name "foo" but with different extensions or the directory named "foo" with its "index" file(according to mainFiles) with different extension than preconfigured resolve.extensions. This could avoid us from setting arbitrary extensions and keep rspack as more Web-spec as possible.
Then rspack can list these suggestions in the help section of each diagnostic.

What does the proposed API of configuration look like?

NO API change.

@h-a-n-a h-a-n-a added feat New feature or request pending triage The issue/PR is currently untouched. and removed pending triage The issue/PR is currently untouched. labels Feb 6, 2024
@github-actions github-actions bot added the team The issue/pr is created by the member of Rspack. label Feb 6, 2024
@h-a-n-a h-a-n-a changed the title [Feature]: Enhanced module resolution error diagnostic [Feature]: improve diagnostic when resolve failed with missing resolve.extensions Feb 6, 2024
@h-a-n-a
Copy link
Contributor Author

h-a-n-a commented Feb 7, 2024

To add this support, you may refer to this for details:

  1. Add a new error hint helper in this file
    pub fn resolve_for_error_hints(
    .
  2. Add a test in packages/rspack/test/diagnostics to test out the diagnostic

@luhc228
Copy link
Contributor

luhc228 commented Feb 18, 2024

I want to have a try.

@hardfist
Copy link
Contributor

@luhc228 thanks in advance

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
contrib: easy contrib: has guidance feat New feature or request PR welcome team The issue/pr is created by the member of Rspack.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants