mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-07 05:12:31 +02:00
fix(v2): check static dir exist before copying (#1526)
This commit is contained in:
parent
517dbc500d
commit
831d96e8e8
1 changed files with 15 additions and 10 deletions
|
@ -68,16 +68,21 @@ export async function build(
|
|||
].filter(Boolean) as Plugin[],
|
||||
});
|
||||
|
||||
let serverConfig: Configuration = merge(createServerConfig(props), {
|
||||
plugins: [
|
||||
new CopyWebpackPlugin([
|
||||
{
|
||||
from: path.resolve(siteDir, STATIC_DIR_NAME),
|
||||
to: outDir,
|
||||
},
|
||||
]),
|
||||
],
|
||||
});
|
||||
let serverConfig: Configuration = createServerConfig(props);
|
||||
|
||||
const staticDir = path.resolve(siteDir, STATIC_DIR_NAME);
|
||||
if (fs.existsSync(staticDir)) {
|
||||
serverConfig = merge(serverConfig, {
|
||||
plugins: [
|
||||
new CopyWebpackPlugin([
|
||||
{
|
||||
from: staticDir,
|
||||
to: outDir,
|
||||
},
|
||||
]),
|
||||
],
|
||||
});
|
||||
}
|
||||
|
||||
// Plugin lifecycle - configureWebpack
|
||||
plugins.forEach(plugin => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue