Skip to content

Commit

Permalink
Fix public folder in dev mode, now it starts by default with the defa…
Browse files Browse the repository at this point in the history
…ult Volto core defined public files (#6081)
  • Loading branch information
sneridagh authored Jun 7, 2024
1 parent 02fb83c commit 4a2da78
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
1 change: 1 addition & 0 deletions packages/volto/news/6081.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fix public folder in dev mode, now it starts by default with the default Volto core defined public files @sneridagh
17 changes: 13 additions & 4 deletions packages/volto/razzle.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,19 @@ const defaultModify = ({
});
};

// If we are in development mode, we copy the public directory to the
// public directory of the setup root, so the files are available
if (dev && !registry.isVoltoProject && registry.addonNames.length > 0) {
const devPublicPath = `${projectRootPath}/../../../public`;
if (!fs.existsSync(devPublicPath)) {
fs.mkdirSync(devPublicPath);
}
mergeDirectories(
path.join(projectRootPath, 'public'),
`${projectRootPath}/../../../public`,
);
}

registry.getAddonDependencies().forEach((addonDep) => {
// What comes from getAddonDependencies is in the form of `@package/addon:profile`
const addon = addonDep.split(':')[0];
Expand All @@ -189,10 +202,6 @@ const defaultModify = ({
!registry.isVoltoProject &&
registry.addonNames.length > 0
) {
const devPublicPath = `${projectRootPath}/../../../public`;
if (!fs.existsSync(devPublicPath)) {
fs.mkdirSync(devPublicPath);
}
mergeDirectories(
path.join(p, 'public'),
`${projectRootPath}/../../../public`,
Expand Down

0 comments on commit 4a2da78

Please sign in to comment.