Skip to content

Commit 2743cfa

Browse files
authored
fix(purgecss-webpack-plugin): allow dynamic paths
Move entryPaths instantiation inside hook to allow dynamic paths.
1 parent f900188 commit 2743cfa

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

  • packages/purgecss-webpack-plugin/src

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

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,16 @@ export default class PurgeCSSPlugin {
5353
}
5454

5555
initializePlugin(compilation: Compilation) {
56-
const entryPaths =
57-
typeof this.options.paths === "function"
58-
? this.options.paths()
59-
: this.options.paths;
60-
61-
entryPaths.forEach(p => {
62-
if (!fs.existsSync(p)) throw new Error(`Path ${p} does not exist.`);
63-
});
64-
6556
compilation.hooks.additionalAssets.tapPromise(pluginName, () => {
57+
const entryPaths =
58+
typeof this.options.paths === "function"
59+
? this.options.paths()
60+
: this.options.paths;
61+
62+
entryPaths.forEach(p => {
63+
if (!fs.existsSync(p)) throw new Error(`Path ${p} does not exist.`);
64+
});
65+
6666
return this.runPluginHook(compilation, entryPaths);
6767
});
6868
}

0 commit comments

Comments
 (0)