Skip to content

Commit

Permalink
fix(plugin-sass): additionalData function type (#2708)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiahan committed Jun 26, 2024
1 parent f2483ac commit 71c66e6
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<img src="https://img.shields.io/node/v/@rsbuild/core.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="node version">
</a>
<a href="https://github.com/web-infra-dev/rsbuild/blob/main/LICENSE">
<img src="https://img.shields.io/npm/l/@rsbuild/core?style=flat-square&colorA=564341&colorB=EDED91" alt="license" />
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" />
</a>
</p>

Expand Down
2 changes: 1 addition & 1 deletion README.zh-CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<img src="https://img.shields.io/node/v/@rsbuild/core.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="node version">
</a>
<a href="https://github.com/web-infra-dev/rsbuild/blob/main/LICENSE">
<img src="https://img.shields.io/npm/l/@rsbuild/core?style=flat-square&colorA=564341&colorB=EDED91" alt="license" />
<img src="https://img.shields.io/badge/License-MIT-blue.svg?style=flat-square&colorA=564341&colorB=EDED91" alt="license" />
</a>
</p>

Expand Down
14 changes: 12 additions & 2 deletions packages/plugin-sass/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,10 @@ import type {
} from 'sass-embedded';
import type SassLoader from '../compiled/sass-loader/index.js';

export type SassLoaderOptions = Omit<SassLoader.Options, 'sassOptions'> &
export type SassLoaderOptions = Omit<
SassLoader.Options,
'sassOptions' | 'additionalData'
> &
(
| {
api?: 'legacy';
Expand All @@ -16,7 +19,14 @@ export type SassLoaderOptions = Omit<SassLoader.Options, 'sassOptions'> &
api: 'modern' | 'modern-compiler';
sassOptions?: SassOptions<'async'>;
}
);
) & {
// @types/sass-loader is outdated
// see https://github.com/web-infra-dev/rsbuild/issues/2582
additionalData?: (
content: string | Buffer,
loaderContext: Rspack.LoaderContext,
) => string;
};

export type PluginSassOptions = {
/**
Expand Down

0 comments on commit 71c66e6

Please sign in to comment.