Skip to content
This repository has been archived by the owner on Feb 24, 2023. It is now read-only.

support windows sub folder path #15

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ export function useDynamicPublicPath(options?: Options): Plugin {
const importerResult = url.match(/\(['"]([\s\S]+)['"]\)/);
if (importerResult instanceof Array && importerResult.length > 1) {
const assetKey = normalizePath(path.join(`${assetsBase}`, importerResult[1]));
bundle[normalizedFile] = bundle[assetKey];
if (bundle[assetKey]) {
bundle[normalizedFile] = bundle[assetKey];
} else {
const assetFile = assetKey.split('/')
const key = Object.keys(bundle).find(k => k.endsWith(assetFile[assetFile.length - 1]))
bundle[normalizedFile] = bundle[key]
}
}
}
}
Expand Down