Skip to content

Commit

Permalink
fix: don't automatically delete next cache (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
dlehmhus authored Jun 5, 2023
1 parent cae4616 commit 62f4603
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions src/plugins/errorPlugin.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import { existsSync, rmSync } from 'fs';
import { Compiler, WebpackError } from 'webpack';

import { isFSCache } from '../utils';
Expand All @@ -21,20 +20,8 @@ export class ErrorPlugin {
(err) => !cssRegex.test(err.message),
);

const { cache, mode } = stats.compilation.compiler.options;

let message =
'🔄 The Linaria cache seems to be out of sync with the webpack cache, let me fix that for you...\n\n';

if (mode === 'production') {
message += 'Please restart the build process!';
} else {
message += 'Please restart the dev server!';
}

if (cache.cacheDirectory && existsSync(cache.cacheDirectory)) {
rmSync(cache.cacheDirectory, { recursive: true, force: true });
}
const message =
'🔄 The Linaria cache seems to be out of sync with the webpack cache, please restart the server.\n For more details see: https://github.com/dlehmhus/next-with-linaria#good-to-know \n\n';

stats.compilation.errors.push(new WebpackError(message));
}
Expand Down

0 comments on commit 62f4603

Please sign in to comment.