fix(plugin): allow multiple loads assets (#3741)

This commit is contained in:
Quincy Qiu
2023-08-15 02:44:52 +08:00
committed by GitHub
parent 58dae07b5f
commit 52102ee792
2 changed files with 8 additions and 3 deletions

View File

@@ -85,12 +85,13 @@ export const pluginRegisterPromise = Promise.all(
if (assets.length > 0) {
await Promise.all(
assets.map(async (asset: string) => {
const loadedAssetName = `${pluginName}_${asset}`;
// todo(himself65): add assets into shadow dom
if (loadedAssets.has(asset)) {
if (loadedAssets.has(loadedAssetName)) {
return Promise.resolve();
}
if (asset.endsWith('.css')) {
loadedAssets.add(asset);
loadedAssets.add(loadedAssetName);
const res = await fetch(`${baseURL}/${asset}`);
if (res.ok) {
// todo: how to put css file into sandbox?