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: export WarnCaseSensitiveModulesPlugin and disable it by default #8697

Merged
merged 4 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ module.exports = {
<t> process module group map: X ms
<t> ensure max size fit: X ms

LOG from rspack.WarnCaseSensitiveModulesPlugin
<t> check case sensitive modules: X ms

LOG from rspack.buildChunkGraph
<t> prepare entrypoints: X ms
<t> process queue: X ms
Expand Down
12 changes: 12 additions & 0 deletions packages/rspack/etc/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5090,6 +5090,7 @@ declare namespace rspackExports {
ExternalsPlugin,
HotModuleReplacementPlugin,
NoEmitOnErrorsPlugin,
WarnCaseSensitiveModulesPlugin,
DllPlugin,
DllPluginOptions,
DllReferencePlugin,
Expand Down Expand Up @@ -10995,6 +10996,17 @@ export class ValidationError extends Error {
// @public (undocumented)
export const version: string;

// @public (undocumented)
export const WarnCaseSensitiveModulesPlugin: {
new (): {
name: BuiltinPluginName;
_args: [];
affectedHooks: "done" | "make" | "compile" | "emit" | "afterEmit" | "invalid" | "thisCompilation" | "afterDone" | "compilation" | "normalModuleFactory" | "contextModuleFactory" | "initialize" | "shouldEmit" | "infrastructureLog" | "beforeRun" | "run" | "assetEmitted" | "failed" | "shutdown" | "watchRun" | "watchClose" | "environment" | "afterEnvironment" | "afterPlugins" | "afterResolvers" | "beforeCompile" | "afterCompile" | "finishMake" | "entryOption" | "additionalPass" | undefined;
raw(compiler: Compiler_2): BuiltinPlugin;
apply(compiler: Compiler_2): void;
};
};

// @public (undocumented)
interface Wasm {
// (undocumented)
Expand Down
1 change: 1 addition & 0 deletions packages/rspack/src/exports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ export { DynamicEntryPlugin } from "./builtin-plugin";
export { ExternalsPlugin } from "./builtin-plugin";
export { HotModuleReplacementPlugin } from "./builtin-plugin";
export { NoEmitOnErrorsPlugin } from "./builtin-plugin";
export { WarnCaseSensitiveModulesPlugin } from "./builtin-plugin";
export { DllPlugin, type DllPluginOptions } from "./lib/DllPlugin";
export {
DllReferencePlugin,
Expand Down
3 changes: 0 additions & 3 deletions packages/rspack/src/rspackOptionsApply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ import {
SizeLimitsPlugin,
SourceMapDevToolPlugin,
SplitChunksPlugin,
WarnCaseSensitiveModulesPlugin,
WorkerPlugin
} from "./builtin-plugin";
import EntryOptionPlugin from "./lib/EntryOptionPlugin";
Expand Down Expand Up @@ -374,8 +373,6 @@ export class RspackOptionsApply {
new SizeLimitsPlugin(options.performance).apply(compiler);
}

new WarnCaseSensitiveModulesPlugin().apply(compiler);

if (options.cache) {
new MemoryCachePlugin().apply(compiler);
}
Expand Down
7 changes: 4 additions & 3 deletions website/docs/en/plugins/webpack/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"banner-plugin",
"context-replacement-plugin",
"define-plugin",
"dll-plugin",
"dll-reference-plugin",
"electron-target-plugin",
"enable-chunk-loading-plugin",
"enable-library-plugin",
Expand All @@ -26,7 +28,6 @@
"runtime-chunk-plugin",
"source-map-dev-tool-plugin",
"split-chunks-plugin",
"internal-plugins",
"dll-plugin",
"dll-reference-plugin"
"warn-case-sensitive-modules-plugin",
"internal-plugins"
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ApiMeta } from '@components/ApiMeta.tsx';

# WarnCaseSensitiveModulesPlugin

<ApiMeta addedVersion={'1.2.0'} />

Detect and warn about case-sensitive module naming conflicts.

When compiling on a file system with other case semantics, if there are multiple modules whose names differ only in casing, it may lead to unexpected error behaviors.

```js
new rspack.WarnCaseSensitiveModulesPlugin();
```
7 changes: 4 additions & 3 deletions website/docs/zh/plugins/webpack/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
"banner-plugin",
"context-replacement-plugin",
"define-plugin",
"dll-plugin",
"dll-reference-plugin",
"electron-target-plugin",
"enable-chunk-loading-plugin",
"enable-library-plugin",
Expand All @@ -26,7 +28,6 @@
"runtime-chunk-plugin",
"source-map-dev-tool-plugin",
"split-chunks-plugin",
"internal-plugins",
"dll-plugin",
"dll-reference-plugin"
"warn-case-sensitive-modules-plugin",
"internal-plugins"
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { ApiMeta } from '@components/ApiMeta.tsx';

# WarnCaseSensitiveModulesPlugin

<ApiMeta addedVersion={'1.2.0'} />

检测并就区分大小写的模块命名冲突发出警告。

当在具有其他大小写语义的文件系统上进行编译时,如果存在多个名称仅大小写不同的模块,可能会导致出现意外的错误行为。

```js
new rspack.WarnCaseSensitiveModulesPlugin();
```
Loading