Skip to content

Commit

Permalink
Warn when trying to export with missing public path
Browse files Browse the repository at this point in the history
  • Loading branch information
ovidiuch committed May 8, 2018
1 parent da5c581 commit e956b67
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion packages/react-cosmos/src/server/export.js
Expand Up @@ -56,7 +56,14 @@ export default function startExport() {
if (publicPath) {
if (outputPath.indexOf(publicPath) === -1) {
const exportPublicPath = path.join(outputPath, publicUrl);
fs.copySync(publicPath, exportPublicPath);
if (fs.existsSync(publicPath)) {
fs.copySync(publicPath, exportPublicPath);
} else {
console.log(
'[Cosmos] Warning: config.publicPath points to missing dir',
publicPath
);
}
} else {
console.warn(
`[Cosmos] Warning: Can't export public path because it contains the export path! (avoiding infinite loop)`
Expand Down

0 comments on commit e956b67

Please sign in to comment.