Skip to content

Commit

Permalink
Replace only javascript script tag
Browse files Browse the repository at this point in the history
  • Loading branch information
Machy8 committed Jul 14, 2024
1 parent 6066cc9 commit 7ab7cc0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions packages/signalizejs/src/modules/snippets.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ export default async ({ params, resolve, root }) => {
}

for (const script of existingSnippet.querySelectorAll('script')) {
const scriptTypeAttribute = script.getAttribute('type');

if (scriptTypeAttribute && !['module', 'text/javascript'].includes(scriptTypeAttribute)) {
continue;
}

const scriptElement = document.createElement('script');
scriptElement.innerHTML = script.innerHTML;
scriptElement.async = false;
Expand Down

0 comments on commit 7ab7cc0

Please sign in to comment.