Skip to content

Commit 287fea1

Browse files
committed
feat: add resolve doc & remove source.resolve
1 parent 0c6d0fd commit 287fea1

File tree

21 files changed

+111
-352
lines changed

21 files changed

+111
-352
lines changed

packages/cli/builder/src/plugins/extensionPrefix.ts

Lines changed: 0 additions & 26 deletions
This file was deleted.

packages/cli/builder/src/plugins/mainFields.ts

Lines changed: 0 additions & 31 deletions
This file was deleted.

packages/cli/builder/src/shared/parseCommonConfig.ts

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -68,14 +68,7 @@ export async function parseCommonConfig(
6868
...outputConfig
6969
} = {},
7070
html: { outputStructure, appIcon, ...htmlConfig } = {},
71-
source: {
72-
alias,
73-
globalVars,
74-
resolveMainFields,
75-
resolveExtensionPrefix,
76-
transformImport,
77-
...sourceConfig
78-
} = {},
71+
source: { alias, globalVars, transformImport, ...sourceConfig } = {},
7972
dev = {},
8073
security: { checkSyntax, sri, ...securityConfig } = {},
8174
tools: {
@@ -234,18 +227,6 @@ export async function parseCommonConfig(
234227
);
235228
}
236229

237-
if (resolveMainFields) {
238-
const { pluginMainFields } = await import('../plugins/mainFields');
239-
rsbuildPlugins.push(pluginMainFields(resolveMainFields));
240-
}
241-
242-
if (resolveExtensionPrefix) {
243-
const { pluginExtensionPrefix } = await import(
244-
'../plugins/extensionPrefix'
245-
);
246-
rsbuildPlugins.push(pluginExtensionPrefix(resolveExtensionPrefix));
247-
}
248-
249230
if (convertToRem) {
250231
const { pluginRem } = await import('@rsbuild/plugin-rem');
251232
rsbuildPlugins.push(

packages/cli/builder/src/types.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,6 @@ export type BuilderExtraConfig = {
153153
* Define global variables. It can replace expressions like `process.env.FOO` in your code after compile.
154154
*/
155155
globalVars?: ChainedGlobalVars;
156-
/**
157-
* This configuration will determine which field of `package.json` you use to import the `npm` module.
158-
* Same as the [resolve.mainFields](https://webpack.js.org/configuration/resolve/#resolvemainfields) config of webpack.
159-
*/
160-
resolveMainFields?: MainFields | Partial<Record<RsbuildTarget, MainFields>>;
161-
/**
162-
* Add a prefix to [resolve.extensions](https://webpack.js.org/configuration/resolve/#resolveextensions).
163-
*/
164-
resolveExtensionPrefix?: string | Partial<Record<RsbuildTarget, string>>;
165156
};
166157
output?: {
167158
/**
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: aliasStrategy
3+
---
4+
5+
# resolve.aliasStrategy
6+
7+
- **Type:** `'prefer-tsconfig' | 'prefer-alias'`
8+
- **Default:** `'prefer-tsconfig'`
9+
10+
Set the strategy for path alias resolution, to control the priority relationship between the paths option in `tsconfig.json` and the [resolve.alias](https://rsbuild.rs/config/resolve/alias) option of Rsbuild.
11+
12+
import RsbuildConfig from '@site-docs/components/rsbuild-config-tooltip';
13+
14+
<RsbuildConfig configName="resolve.aliasStrategy" />
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
---
2+
title: alias
3+
---
4+
5+
# resolve.alias
6+
7+
- **Type:** `string[]`
8+
9+
Create aliases for module paths to simplify import paths or redirect module references.
10+
11+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
12+
13+
<RsbuildConfig configName="resolve.alias" />
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: conditionNames
3+
---
4+
5+
# resolve.conditionNames
6+
7+
- **Type:** `string[]`
8+
- **Default:** Same as Rspack's `resolve.conditionNames`
9+
10+
Specifies the condition names used to match entry points in the [exports](https://nodejs.org/api/packages.html#packages_exports) of a package.
11+
12+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
13+
14+
<RsbuildConfig configName="resolve.extensions" />
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
title: extensions
3+
---
4+
5+
# resolve.extensions
6+
7+
- **Type:** `string[]`
8+
- **Default:** `['.ts', '.tsx', '.mjs', '.js', '.jsx', '.json']`
9+
10+
Automatically resolve file extensions when importing modules. This means you can import files without explicitly writing their extensions.
11+
12+
import RsbuildConfig from '@site-docs-en/components/rsbuild-config-tooltip';
13+
14+
<RsbuildConfig configName="resolve.extensions" />

packages/document/main-doc/docs/en/configure/app/source/resolve-extension-prefix.mdx

Lines changed: 0 additions & 55 deletions
This file was deleted.

packages/document/main-doc/docs/en/configure/app/source/resolve-main-fields.mdx

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)