Skip to content

Commit f0cfe86

Browse files
authored
fix: avoid unexpected cache hits (#48)
Use instance `postcssProcessorCache` attribute instead of static `postcssProcessorCache` in `TailwindRspackPluginImpl` class. Avoid unexpected cache hits due to import cache when multiple builds. related: #47
1 parent 1ceee28 commit f0cfe86

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/TailwindCSSRspackPlugin.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ export type { TailwindRspackPluginOptions };
179179
class TailwindRspackPluginImpl {
180180
name = 'TailwindRspackPlugin';
181181

182-
static #postcssProcessorCache = new Map<
182+
postcssProcessorCache = new Map<
183183
/** entryName */ string,
184184
[entryModules: ReadonlySet<string>, Processor]
185185
>();
@@ -209,8 +209,7 @@ class TailwindRspackPluginImpl {
209209
return;
210210
}
211211

212-
const cache =
213-
TailwindRspackPluginImpl.#postcssProcessorCache.get(entryName);
212+
const cache = this.postcssProcessorCache.get(entryName);
214213
if (compiler.modifiedFiles?.size && cache) {
215214
const [cachedEntryModules, cachedPostcssProcessor] = cache;
216215
if (isSubsetOf(compiler.modifiedFiles, cachedEntryModules)) {
@@ -268,7 +267,7 @@ class TailwindRspackPluginImpl {
268267
...(options.postcssOptions?.plugins ?? []),
269268
]);
270269

271-
TailwindRspackPluginImpl.#postcssProcessorCache.set(entryName, [
270+
this.postcssProcessorCache.set(entryName, [
272271
entryModules,
273272
processor,
274273
]);

0 commit comments

Comments
 (0)