Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion e2e/scripts/shared.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import assert from 'node:assert';
import fs from 'node:fs';
import net from 'node:net';
import { join } from 'node:path';
import { URL } from 'node:url';
Expand Down Expand Up @@ -121,7 +122,7 @@ const updateConfigForTest = async (
printUrls: false,
},
performance: {
buildCache: false,
buildCache: true,
printFileSize: false,
},
};
Expand All @@ -136,6 +137,13 @@ const unwrapOutputJSON = async (distPath: string, ignoreMap = true) => {
});
};

const cleanCache = (cwd = process.cwd()) => {
const cacheDirectory = join(cwd, 'node_modules', '.cache');
if (fs.existsSync(cacheDirectory)) {
fs.rmSync(cacheDirectory, { recursive: true, force: true });
}
};

export async function dev({
plugins,
page,
Expand Down Expand Up @@ -163,6 +171,8 @@ export async function dev({
options.cwd,
);

// cleanCache(options.cwd);

const rsbuild = await createRsbuild(options, plugins);

rsbuild.addPlugins([
Expand Down Expand Up @@ -239,6 +249,8 @@ export async function build({
options.cwd,
);

// cleanCache(options.cwd);

const rsbuild = await createRsbuild(options, plugins);

await rsbuild.build();
Expand Down
Loading