Plugin for SpessaSynth Soundfont Synth - Help fetching local files on runtime

Hello, I am trying to develop a plugin which should run Spessa-Synth_lib (/spessasynth_lib) to generate audio. From the docs of spessa i see that we need a audioworklet. i already have imported the spessa_lib, but i cannot create a synth instance because i need to fetch a .js file in runtime to initialize the Worklet. the problem is:

Blockquote async function addWorkletHelper(context)
{
await context.audioWorklet.addModule(“./worklet_processor.min.js”)
} I tried all kind of things to load the file " worklet_processor.min.js" which is in my plugins root, as well as in the /asstes folder. i have declared it in manifest… but when running the code it always fails to fetch the file. Is this really some sort of security resitriction from Obsidian itself? Can someone please help me with this? This is my code that fails: // Step 2: Create AudioContext
this.audioContext = new AudioContext();
console.log(“:white_check_mark: AudioContext created”, { state: this.audioContext.state, sampleRate: this.audioContext.sampleRate });

  // Step 3: Load AudioWorklet via CSP-safe Blob
  const workletUrl = `/plugins/${PLUGIN_ID}/assets/worklet_processor.min.js`;
  console.log("Step 2: Loading worklet from", workletUrl);

Console: :package: spessasynth_lib module: { DEFAULT_SYNTH_CONFIG: [Getter],
FancyChorus: [Getter],
MIDIDeviceHandler: [Getter],
Sequencer: [Getter],
Synthetizer: [Getter],
WORKLET_URL_ABSOLUTE: [Getter],
WebMIDILinkHandler: [Getter],
audioBufferToWav: [Getter],
getReverbProcessor: [Getter] }
:white_check_mark: AudioContext created { state: ‘running’, sampleRate: 48000 }
Step 2: Loading worklet from ‘/plugins/music-code-blocks1/worklet_processor.min.js’
:skull: SpessaSynth init failed: ‘Failed to fetch’
Spessasynth initialized: false

  1. You mentioned folder assets inside of your plugin folder. Where will it come from? When plugin installs, you can distribute only main.js file, no assets are supported by Obsidian plugin installer.

i have declared it in manifest

Obsidian plugin manifest doesn’t support additional assets.

  1. Ignoring the problem from previous bullet point, you need to use the full path:
const relativePath = `${this.manifest.dir}/assets/worklet_processor.min.js`;
const fullPath = this.app.vault.adapter.getFullPath(relativePath);
await context.audioWorklet.addModule(fullPath);