Skip to content

Commit

Permalink
Determine Best AssetUrl is in easy mode with the new build system
Browse files Browse the repository at this point in the history
  • Loading branch information
myovchev committed Nov 23, 2024
1 parent d3fd291 commit 8b37052
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion modules/@apostrophecms/module/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -818,7 +818,8 @@ module.exports = {
let urlOption = self.options[`${name}Url`];
const imageOption = self.options[`${name}Image`];
if (!urlOption) {
if (imageOption) {
// Webpack and the legacy asset pipeline
if (imageOption && !self.apos.asset.hasBuildModule()) {
const chain = [ ...self.__meta.chain ].reverse();
for (const entry of chain) {
const path = `${entry.dirname}/public/${name}.${imageOption}`;
Expand All @@ -828,6 +829,10 @@ module.exports = {
}
}
}
// The new external module asset pipeline
if (imageOption && self.apos.asset.hasBuildModule()) {
urlOption = `/modules/${self.__meta.name}/${name}.${imageOption}`;
}
}
if (urlOption && urlOption.startsWith('/modules')) {
urlOption = self.apos.asset.url(urlOption);
Expand Down

0 comments on commit 8b37052

Please sign in to comment.