sveltedash.js

'target' is a required option


I am trying to add the official control panel to dash.js player using Svelte.

I've followed instructions from Readme, which are very simple - just a matter of adding some HTML, CSS and a .js file. But Svelte doesn't like something - I am getting several vague errors in debugger:

[HMR][Svelte] Unrecoverable HMR error in <PlayerControlPanel>: next update will trigger a full reload
Uncaught (in promise) Error: 'target' is a required option

Please see REPL

How should the control panel be added?


Solution

  • target specifies where a component constructed in client-side code is to be added (see docs).

    You can't just export a constructor from a component, a component always has the same signature. You probably should restructure the code to initialize the bar in onMount and add the component directly in markup instead of trying to construct it manually.