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

This commit is contained in:
Quincy Qiu
2023-08-14 18:44:52 +00:00
committed by GitHub
parent 58dae07b5f
commit 52102ee792
2 changed files with 8 additions and 3 deletions
+3 -2
View File
@@ -85,12 +85,13 @@ export const pluginRegisterPromise = Promise.all(
if (assets.length > 0) { if (assets.length > 0) {
await Promise.all( await Promise.all(
assets.map(async (asset: string) => { assets.map(async (asset: string) => {
const loadedAssetName = `${pluginName}_${asset}`;
// todo(himself65): add assets into shadow dom // todo(himself65): add assets into shadow dom
if (loadedAssets.has(asset)) { if (loadedAssets.has(loadedAssetName)) {
return Promise.resolve(); return Promise.resolve();
} }
if (asset.endsWith('.css')) { if (asset.endsWith('.css')) {
loadedAssets.add(asset); loadedAssets.add(loadedAssetName);
const res = await fetch(`${baseURL}/${asset}`); const res = await fetch(`${baseURL}/${asset}`);
if (res.ok) { if (res.ok) {
// todo: how to put css file into sandbox? // todo: how to put css file into sandbox?
+5 -1
View File
@@ -10,4 +10,8 @@ const count = ref(0);
</el-button> </el-button>
</template> </template>
<style scoped></style> <style scoped>
.el-button {
font-size: 30px;
}
</style>