Replace filter not working in App Script/CSS

Shopify replace filter works well, but it’s not working well with apps

For Example a app adding:


Here i want to replace

replace:'src="https://cdn.shopify.com/extensions/', 'src="https://cdn.domain.com/https://cdn.shopify.com/extensions/'

or

replace: 'defer="defer"',  "async"

both replace not working on frontend, but working on themes files, what could be possible reason? how to make it work? I am using capture for full html and replace inside that capture