Skip to content

Commit 70890af

Browse files
authored
Merge pull request #792 from processing/fix/p5sound
Fix/p5sound
2 parents b27eca9 + 792cfd0 commit 70890af

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/components/CodeEmbed/frame.tsx

+3-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,9 @@ canvas {
4242
}
4343
${code.css || ""}
4444
</style>
45-
${(code.scripts ?? []).map((src) => `<script type="text/javascript" src="${src}"></script>`).join('\n')}
45+
<!-- If we need an addon script, load p5 the usual way with no caching to make sure
46+
the import order doesn't get messed up. -->
47+
${((code.scripts?.length ?? 0) > 0 ? [cdnLibraryUrl, ...(code.scripts ?? [])] : []).map((src) => `<script type="text/javascript" src="${src}"></script>`).join('\n')}
4648
<body>${code.htmlBody || ""}</body>
4749
<script id="code" type="text/javascript">${wrapSketch(code.js) || ""}</script>
4850
${(code.scripts?.length ?? 0) > 0 ? '' : `

0 commit comments

Comments
 (0)