partytown
partytown copied to clipboard
Append script element with partytown is not working
I am using the below JS snippet to append the script element with partytown typefor the appdynamics library
export function asyncJs(url, elementName, onload = () => {}) {
const el = document.createElement('script');
el.setAttribute('src', url);
el.setAttribute('type', 'text/partytown');
el.setAttribute('async', true);
el.onload = onload;
const targetEl = document.getElementsByTagName(elementName)[0];
return targetEl.appendChild(el);
}
But its not loaded the third party script from the partytown
Whereas the third party script that I directly added the partytown type is working fine.
Can you please advice what is the issue here.
After I include the script tag with partytown.js, the appdynamic script loads from partytown webworker.
const ptEl = document.createElement('script');
const el = document.createElement('script');
ptEl.setAttribute('src', '/~partytown/debug/partytown.js');
ptEl.setAttribute('aync', true);
el.setAttribute('src', url);
el.setAttribute('type', 'text/partytown');
el.setAttribute('async', true);
el.onload = onload;
document.head.appendChild(ptEl);
document.head.appendChild(el);
return document;
But for App Dynamics getting the below error when it loads from the partytown web worker.
hey @niyazafazl - we've just created an issue template, could you update your issue here to provide all the information the template asks for? it'll help us look into your issue https://github.com/BuilderIO/partytown/issues/new?assignees=&labels=&template=bug_report.md&title=
pasting below to make things easier:
Describe the bug A clear and concise description of what the bug is.
To Reproduce Steps to reproduce the behavior:
- Go to '...'
- Click on '....'
- Scroll down to '....'
- See error
Reproduction link Please include a link to a Stackblitz or Codesandbox reproducing the issue. We will need to see the issue reproduced with hand-written code - we can't debug giant minified third party scripts directly. If you do not include a clean and simple reproduction of your issue, we won't be able to look into it until you do.
Expected behavior A clear and concise description of what you expected to happen.
Screenshots If applicable, add screenshots to help explain your problem.
Additional context Add any other context about the problem here.
Closing this issue since it has become stale, or has been addressed in recent releases and docs updates. If you feel this is still an issue please reopen a new issue. Thanks.