Skip to content

Commit

Permalink
feat: export and disable it by default
Browse files Browse the repository at this point in the history
  • Loading branch information
ahabhgk committed Dec 13, 2024
1 parent a313b28 commit 520b46f
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 9 deletions.
12 changes: 12 additions & 0 deletions packages/rspack/etc/core.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5076,6 +5076,7 @@ declare namespace rspackExports {
ExternalsPlugin,
HotModuleReplacementPlugin,
NoEmitOnErrorsPlugin,
WarnCaseSensitiveModulesPlugin,
DllPlugin,
DllPluginOptions,
DllReferencePlugin,
Expand Down Expand Up @@ -10966,6 +10967,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 @@ -64,7 +64,6 @@ import {
SizeLimitsPlugin,
SourceMapDevToolPlugin,
SplitChunksPlugin,
WarnCaseSensitiveModulesPlugin,
WorkerPlugin
} from "./builtin-plugin";
import EntryOptionPlugin from "./lib/EntryOptionPlugin";
Expand Down Expand Up @@ -361,8 +360,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();
```

0 comments on commit 520b46f

Please sign in to comment.