Skip to content

Commit 5b029c2

Browse files
committed
fix: webpack plugin option blocklist types
- add blocklist function as a type
1 parent 296c91f commit 5b029c2

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

packages/purgecss-webpack-plugin/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export default class PurgeCSSPlugin {
102102
if (typeof options.safelist === "function") {
103103
options.safelist = options.safelist();
104104
}
105-
105+
106106
if (typeof options.blocklist === "function") {
107107
options.blocklist = options.blocklist();
108108
}

packages/purgecss-webpack-plugin/src/types/index.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ export interface Extractors {
1717
}
1818

1919
type PathFunction = () => string[];
20-
2120
type SafelistFunction = () => ComplexSafelist;
21+
type BlocklistFunction = () => StringRegExpArray;
2222

2323
export interface UserDefinedOptions {
2424
paths: string[] | PathFunction;
@@ -34,7 +34,7 @@ export interface UserDefinedOptions {
3434
variables?: boolean;
3535
verbose?: boolean;
3636
safelist?: StringRegExpArray | ComplexSafelist | SafelistFunction;
37-
blocklist?: StringRegExpArray;
37+
blocklist?: StringRegExpArray | BlocklistFunction;
3838
only?: string[];
3939
}
4040

packages/rollup-plugin-purgecss/__tests__/index.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ describe("rollup-plugin-purgecss", () => {
1414
}),
1515
],
1616
});
17-
await bundle.generate({ format: "cjs" });
17+
await bundle.generate({ format: "cjs", exports: "auto" });
1818

1919
const actualA = fs
2020
.readFileSync(path.resolve(__dirname, "assets/actual_a.css"))

0 commit comments

Comments
 (0)