Skip to content

docs(diagnostic): add loader experimental diagnostic API#10287

Merged
h-a-n-a merged 9 commits intomainfrom
docs-diagnostic
May 7, 2025
Merged

docs(diagnostic): add loader experimental diagnostic API#10287
h-a-n-a merged 9 commits intomainfrom
docs-diagnostic

Conversation

@h-a-n-a
Copy link
Copy Markdown
Contributor

@h-a-n-a h-a-n-a commented May 7, 2025

Summary

closes #10065

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@github-actions github-actions bot added release: document release: document related release(mr only) team The issue/pr is created by the member of Rspack. labels May 7, 2025
@h-a-n-a h-a-n-a requested a review from chenjiahan May 7, 2025 09:03
@netlify
Copy link
Copy Markdown

netlify bot commented May 7, 2025

Deploy Preview for rspack ready!

Name Link
🔨 Latest commit e7ea845
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/681b3da33eae4400088db44d
😎 Deploy Preview https://deploy-preview-10287--rspack.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.


```
ERROR in ./some-file.js
(./with-file.js!) 1:1-4
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are both some-file.js and with-file.js printed in this example, can you explain the relationship between them?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

./some-file.js is a custom filename, ./with-file.js! is the module identifier in which the loader has been processed and emitted an error. This maybe useful for those loaders who bundles a few files and is still willing to print diagnostic for some certain files.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, with-file is a bit confusing, maybe we can use current-file.js or original-file.js instead.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will change with-file to loader.js as this is the filename of the loader.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tested in a demo and it seems to be the module identifier of current module rather than loader filename:

image

Copy link
Copy Markdown
Contributor Author

@h-a-n-a h-a-n-a May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used inline loader for the test. Check this out.

Copy link
Copy Markdown
Member

@chenjiahan chenjiahan May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When using inline loaders, the log:

# should be 
./current-file.jsx (./loader.js!./current-file.jsx) 1:1-4

# instead of
(./loader.js!) 1:1-4

image

Copy link
Copy Markdown
Contributor Author

@h-a-n-a h-a-n-a May 7, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

h-a-n-a and others added 7 commits May 7, 2025 17:25
Co-authored-by: neverland <chenjiahan.jait@bytedance.com>
Co-authored-by: neverland <chenjiahan.jait@bytedance.com>
Co-authored-by: neverland <chenjiahan.jait@bytedance.com>
Co-authored-by: neverland <chenjiahan.jait@bytedance.com>
Co-authored-by: neverland <chenjiahan.jait@bytedance.com>
Co-authored-by: neverland <chenjiahan.jait@bytedance.com>
@h-a-n-a h-a-n-a enabled auto-merge (squash) May 7, 2025 09:50
@h-a-n-a h-a-n-a requested a review from chenjiahan May 7, 2025 11:03
Copy link
Copy Markdown
Member

@chenjiahan chenjiahan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 👍

@h-a-n-a h-a-n-a merged commit 87ff236 into main May 7, 2025
23 checks passed
@h-a-n-a h-a-n-a deleted the docs-diagnostic branch May 7, 2025 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: document release: document related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[docs]: add documentation for loaderContext.experiments.emitDiagnostic

2 participants