Skip to content

Commit 05e170c

Browse files
authored
feat(plugin-less): improve loader options type with JSDoc (#5182)
1 parent 0a2b31e commit 05e170c

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

packages/plugin-less/src/index.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,26 @@ export const isPlainObject = (obj: unknown): obj is Record<string, any> => {
2222
export const PLUGIN_LESS_NAME = 'rsbuild:less';
2323

2424
export type LessLoaderOptions = {
25+
/**
26+
* Options passed to less.
27+
* @see https://lesscss.org/usage/#less-options
28+
*/
2529
lessOptions?: import('../compiled/less/index.js').default.Options;
30+
/**
31+
* Prepends or appends Less code to the actual entry file.
32+
* This is especially useful when some of your Less variables
33+
* depend on the environment.
34+
*/
2635
additionalData?:
2736
| string
2837
| ((
2938
content: string,
3039
loaderContext: Rspack.LoaderContext<LessLoaderOptions>,
3140
) => string | Promise<string>);
41+
/**
42+
* Whether to source map generation.
43+
* @default depends on the `devtool` value of Rspack
44+
*/
3245
sourceMap?: boolean;
3346
/**
3447
* Enables or disables the built-in Rspack resolver.
@@ -38,6 +51,11 @@ export type LessLoaderOptions = {
3851
* @default true
3952
*/
4053
webpackImporter?: boolean | 'only';
54+
/**
55+
* Determines which implementation of Less to use.
56+
* Can be used to override the pre-bundled version of less.
57+
* @default "@rsbuild/plugin-less/compiled/less/index.js"
58+
*/
4159
implementation?: unknown;
4260
};
4361

0 commit comments

Comments
 (0)