mirror of
https://github.com/facebook/docusaurus.git
synced 2025-08-06 10:20:09 +02:00
fix(v2): should be able to build even if static folder doesnt exist (#1479)
This commit is contained in:
parent
0e5cac94cb
commit
05ba7d835d
1 changed files with 12 additions and 10 deletions
|
@ -92,16 +92,18 @@ module.exports = async function build(siteDir, cliOptions = {}) {
|
||||||
|
|
||||||
// Copy static files.
|
// Copy static files.
|
||||||
const staticDir = path.resolve(siteDir, 'static');
|
const staticDir = path.resolve(siteDir, 'static');
|
||||||
const staticFiles = await globby(['**'], {
|
if (fs.existsSync(staticDir)) {
|
||||||
cwd: staticDir,
|
const staticFiles = await globby(['**'], {
|
||||||
});
|
cwd: staticDir,
|
||||||
await Promise.all(
|
});
|
||||||
staticFiles.map(async source => {
|
await Promise.all(
|
||||||
const fromPath = path.resolve(staticDir, source);
|
staticFiles.map(async source => {
|
||||||
const toPath = path.resolve(outDir, source);
|
const fromPath = path.resolve(staticDir, source);
|
||||||
return fs.copy(fromPath, toPath);
|
const toPath = path.resolve(outDir, source);
|
||||||
}),
|
return fs.copy(fromPath, toPath);
|
||||||
);
|
}),
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
/* Plugin lifecycle - postBuild */
|
/* Plugin lifecycle - postBuild */
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue