diff --git a/src/dataurl.ts b/src/dataurl.ts index 13bc8b43..dbe1cc9b 100644 --- a/src/dataurl.ts +++ b/src/dataurl.ts @@ -69,14 +69,15 @@ export async function resourceToDataURL( options.includeQueryParams, ) - if (cache[cacheKey] != null) { - return cache[cacheKey] - } - + // ref: https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest#Bypassing_the_cache if (options.cacheBust) { // eslint-disable-next-line no-param-reassign resourceUrl += (/\?/.test(resourceUrl) ? '&' : '?') + new Date().getTime() + }else{ + if (cache[cacheKey] != null) { + return cache[cacheKey] + } } let dataURL: string diff --git a/src/index.ts b/src/index.ts index 2de59a30..0e66907e 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,8 +18,8 @@ export async function toSvg( ): Promise { const { width, height } = getImageSize(node, options) const clonedNode = (await cloneNode(node, options, true)) as HTMLElement - await embedWebFonts(clonedNode, options) await embedImages(clonedNode, options) + await embedWebFonts(clonedNode, options) applyStyle(clonedNode, options) const datauri = await nodeToDataURL(clonedNode, width, height) return datauri