Proposed method

const blob = new Blob([svgData], {type: "image/svg+xml" })
const svgDataUrl = URL.createObjectURL(blob)

Input SVG image

Output PNG image