I have successfully integrated an external SVG into my Vue application as a Vue Component using the vue-svg-loader. This is the loader configuration I used to ensure that IDs are not removed:
{
test: /\.svg$/,
loader: 'vue-svg-loader',
options: {
svgo: {
plugins: [
{removeDoctype: true},
{removeComments: true},
{cleanupIDs: false}
]
}
}
}
The structure of the SVG I am trying to load is as follows:
<svg class="external-svg">
<g class="group-1">
<path id="a"></path>
<path id="b"></path>
<path id="c"></path>
</g>
<g class="group-2">
<path id="d"></path>
</g>
<g class="group-3">
<path id="e"></path>
<path id="f"></path>
<path id="g"></path>
</g>
<g class="group-4">
<path id="h"></path>
</g>
<g class="group-5">
</g>
</svg>
Although the svg loads successfully with the loader, some of the group tags get dropped. The final result is missing "group-2", "group-4" and "group-5", but the paths inside remain intact.
If anyone has encountered this issue or knows of a solution, your input would be greatly appreciated!
Thank you!