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

docs: improve devtool docs #9832

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

docs: improve devtool docs #9832

wants to merge 2 commits into from

Conversation

SyMind
Copy link
Member

@SyMind SyMind commented Mar 28, 2025

Summary

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 Mar 28, 2025
Copy link

netlify bot commented Mar 28, 2025

Deploy Preview for rspack ready!

Name Link
🔨 Latest commit 96576a4
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/67e688b7d49e140008a594b2
😎 Deploy Preview https://deploy-preview-9832--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.

@SyMind SyMind marked this pull request as ready for review March 28, 2025 11:29
@SyMind SyMind force-pushed the improve-devtool-docs branch from c3e44dd to 96576a4 Compare March 28, 2025 11:32
| 'eval-nosources-cheap-source-map'
| 'eval-nosources-cheap-module-source-map'
| 'eval-nosources-source-map';
type Devtool = 'string' | false;
```

- **Default:** `eval`
Copy link
Member

Choose a reason for hiding this comment

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

This default value is not correct. Can we clarify the default value in different mode? And Rspack CLI also has a different default value.

@@ -4,54 +4,85 @@ import WebpackLicense from '@components/WebpackLicense';

# Devtool

调试:该选项用于控制 Source Map 的生成行为。
该选项用于控制调试信息生成策略,影响调试能力与构建性能。
Copy link
Member

Choose a reason for hiding this comment

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

How about "控制 source map 和调试信息的生成"


- **不需要** → 设置 `devtool: false`
- 禁用所有调试信息
- 零额外构建开销,极致构建速度
Copy link
Member

Choose a reason for hiding this comment

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

This wording is more like that in a promotional article than in an official configuration document.

| nosources | SourceMap is created without the `sourcesContent` in it |
| debugids | SourceMap is created with the `debugId` in it |

We expect a certain pattern when validate devtool name, pay attention and don't mix up the sequence of devtool string. The pattern is: `[inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map[-debugids]`.
Copy link
Member

Choose a reason for hiding this comment

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

[inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map[-debugids] is too complex for most users


### Step 2: Define Debugging Requirements

- **Module-level positioning only** → Set `devtool: 'eval'`
Copy link
Member

Choose a reason for hiding this comment

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

I feel that eval is no longer a recommended value. None of the frameworks based on webpack/Rspack use eval by default, and the code readability is quite poor.

Copy link
Member

@chenjiahan chenjiahan Mar 31, 2025

Choose a reason for hiding this comment

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

Even if we want to use eval, we should not use "devtool: 'eval'". We should write it like process.env.NODE_ENV === 'production' ? 'source-map' : 'eval'


It also supports combination with the following modifiers to improve performance and control SourceMap generation.

Performance optimization modifiers, to speed up the build, usually used in development environments:
Copy link
Member

Choose a reason for hiding this comment

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

The modifier part is more specific, I suggest putting it after "Recommended configurations"

Copy link
Member

Choose a reason for hiding this comment

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

Perhaps the "Configuration guide" and "Recommended configuration" sections should be combined together. Looking at the "Configuration guide" alone does not seem to be of practical reference.

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.

2 participants