fix: use importmap to resolve spessasynth_core bare import
- Add importmap in index.html to map spessasynth_core to CDN URL - Load spessasynth_lib from CDN directly (with importmap resolving deps) - WorkerSynthesizer fallback also uses CDN import - Ensures library and processor use same spessasynth_core version
This commit is contained in:
@@ -67,7 +67,7 @@
|
|||||||
_initInProgress = false;
|
_initInProgress = false;
|
||||||
console.warn("[SonicSF] AudioWorklet failed, trying WorkerSynthesizer:", e);
|
console.warn("[SonicSF] AudioWorklet failed, trying WorkerSynthesizer:", e);
|
||||||
try {
|
try {
|
||||||
const mod = await import("https://esm.sh/spessasynth_lib@4.3.1");
|
const mod = await import("https://cdn.jsdelivr.net/npm/spessasynth_lib@4.3.1/dist/index.js");
|
||||||
_synthInstance = new mod.WorkerSynthesizer(audioContext);
|
_synthInstance = new mod.WorkerSynthesizer(audioContext);
|
||||||
await _synthInstance.isReady;
|
await _synthInstance.isReady;
|
||||||
_initialized = true;
|
_initialized = true;
|
||||||
|
|||||||
@@ -10,11 +10,18 @@
|
|||||||
<script src="https://unpkg.com/lucide@latest"></script>
|
<script src="https://unpkg.com/lucide@latest"></script>
|
||||||
<script src="https://unpkg.com/react@18.3.1/umd/react.production.min.js"></script>
|
<script src="https://unpkg.com/react@18.3.1/umd/react.production.min.js"></script>
|
||||||
<script src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.production.min.js"></script>
|
<script src="https://unpkg.com/react-dom@18.3.1/umd/react-dom.production.min.js"></script>
|
||||||
|
<script type="importmap">
|
||||||
|
{
|
||||||
|
"imports": {
|
||||||
|
"spessasynth_core": "https://cdn.jsdelivr.net/npm/spessasynth_core@latest/dist/spessasynth_core.mjs"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
</script>
|
||||||
<script type="module">
|
<script type="module">
|
||||||
import { WorkletSynthesizer } from 'https://esm.sh/spessasynth_lib@4.3.1';
|
import { WorkletSynthesizer } from 'https://cdn.jsdelivr.net/npm/spessasynth_lib@4.3.1/dist/index.js';
|
||||||
window.SpessaSynthClass = WorkletSynthesizer;
|
window.SpessaSynthClass = WorkletSynthesizer;
|
||||||
window.__SpessaSynthCDN = '/static/js/services/';
|
window.__SpessaSynthCDN = 'https://cdn.jsdelivr.net/npm/spessasynth_lib@4.3.1/dist/';
|
||||||
console.log('[SonicSF] SpessaSynth library loaded via esm.sh.');
|
console.log('[SonicSF] SpessaSynth library loaded from CDN.');
|
||||||
</script>
|
</script>
|
||||||
<script src="/static/js/services/api.js?v=202607232105"></script>
|
<script src="/static/js/services/api.js?v=202607232105"></script>
|
||||||
<script src="/static/js/services/audioEngine.js?v=202607232105"></script>
|
<script src="/static/js/services/audioEngine.js?v=202607232105"></script>
|
||||||
|
|||||||
Reference in New Issue
Block a user