diff --git a/src/client/theme-default/components/BuySellAds.vue b/src/client/theme-default/components/BuySellAds.vue index 60e1a692..6c998b39 100644 --- a/src/client/theme-default/components/BuySellAds.vue +++ b/src/client/theme-default/components/BuySellAds.vue @@ -45,6 +45,10 @@ onMounted(() => { function load() { if (typeof _bsa !== 'undefined' && _bsa) { + const parent = document.querySelector('.bsa-cpc')! + // cleanup any existing ad to avoid them stacking + parent.innerHTML = '' + _bsa.init('default', code, `placement:${placement}`, { target: '.bsa-cpc', align: 'horizontal', diff --git a/src/node/build/bundle.ts b/src/node/build/bundle.ts index ec2e228d..672e3bbe 100644 --- a/src/node/build/bundle.ts +++ b/src/node/build/bundle.ts @@ -64,7 +64,9 @@ export async function bundle( if (!chunk.isEntry && /runtime/.test(chunk.name)) { return `assets/framework.[hash].js` } - return `assets/[name].[hash].js` + return adComponentRE.test(chunk.name) + ? `assets/ui-custom.[hash].js` + : `assets/[name].[hash].js` } }) } @@ -95,3 +97,5 @@ export async function bundle( return [clientResult, serverResult, pageToHashMap] } + +const adComponentRE = /(?:Carbon|BuySell)Ads/