Skip to content

Commit fc61ec0

Browse files
committed
remove clean-webpack-plugin
1 parent e1e4801 commit fc61ec0

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

packages/docusaurus/src/commands/build/buildLocale.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ export async function buildLocale({
8080
}),
8181

8282
// We also clear website/build dir
83-
// void, no useful result but need to be done before compilation
83+
// returns void, no useful result needed before compilation
84+
// See also https://github.com/facebook/docusaurus/pull/11037
8485
clearPath(outDir),
8586
]),
8687
);

packages/docusaurus/src/commands/clear.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ import {
1515
import clearPath from './utils/clearPath';
1616

1717
async function removePath(entry: {path: string; description: string}) {
18+
if (!(await fs.pathExists(entry.path))) {
19+
return;
20+
}
1821
try {
1922
await clearPath(entry.path);
2023
logger.success`Removed the ${entry.description} at path=${path.relative(

packages/docusaurus/src/commands/utils/clearPath.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* LICENSE file in the root directory of this source tree.
66
*/
77

8-
import fs from 'fs-extra';
98
import path from 'path';
9+
import {rm} from 'fs/promises';
1010
import {PerfLogger} from '@docusaurus/logger';
1111

1212
/**
@@ -16,10 +16,7 @@ export default async function clearPath(pathToClear: string): Promise<void> {
1616
return PerfLogger.async(
1717
`clearPath ${path.relative(process.cwd(), pathToClear)}`,
1818
async () => {
19-
if (!(await fs.pathExists(pathToClear))) {
20-
return;
21-
}
22-
await fs.remove(pathToClear);
19+
await rm(pathToClear, {recursive: true, force: true});
2320
},
2421
);
2522
}

0 commit comments

Comments
 (0)