diff --git a/packages/purgecss-webpack-plugin/src/index.ts b/packages/purgecss-webpack-plugin/src/index.ts index a77ae101..f5b6fcf3 100644 --- a/packages/purgecss-webpack-plugin/src/index.ts +++ b/packages/purgecss-webpack-plugin/src/index.ts @@ -102,7 +102,7 @@ export default class PurgeCSSPlugin { if (typeof options.safelist === "function") { options.safelist = options.safelist(); } - + if (typeof options.blocklist === "function") { options.blocklist = options.blocklist(); } diff --git a/packages/purgecss-webpack-plugin/src/types/index.ts b/packages/purgecss-webpack-plugin/src/types/index.ts index fc85bb69..6de1a09c 100644 --- a/packages/purgecss-webpack-plugin/src/types/index.ts +++ b/packages/purgecss-webpack-plugin/src/types/index.ts @@ -17,8 +17,8 @@ export interface Extractors { } type PathFunction = () => string[]; - type SafelistFunction = () => ComplexSafelist; +type BlocklistFunction = () => StringRegExpArray; export interface UserDefinedOptions { paths: string[] | PathFunction; @@ -34,7 +34,7 @@ export interface UserDefinedOptions { variables?: boolean; verbose?: boolean; safelist?: StringRegExpArray | ComplexSafelist | SafelistFunction; - blocklist?: StringRegExpArray; + blocklist?: StringRegExpArray | BlocklistFunction; only?: string[]; } diff --git a/packages/rollup-plugin-purgecss/__tests__/index.test.ts b/packages/rollup-plugin-purgecss/__tests__/index.test.ts index 4ba64a7f..427364a2 100644 --- a/packages/rollup-plugin-purgecss/__tests__/index.test.ts +++ b/packages/rollup-plugin-purgecss/__tests__/index.test.ts @@ -14,7 +14,7 @@ describe("rollup-plugin-purgecss", () => { }), ], }); - await bundle.generate({ format: "cjs" }); + await bundle.generate({ format: "cjs", exports: "auto" }); const actualA = fs .readFileSync(path.resolve(__dirname, "assets/actual_a.css"))