captbaritone/webamp

Webamp fails to initialize following v2 merge

Closed this issue · 1 comments

Hi @captbaritone - I woke up this morning to do some work on a personal project which implements Webamp (has been using it reliably for a few weeks already).

However I've noticed that webamp now fails to initialize following some recent merges here.

Specifically I'm seeing:

Uncaught SyntaxError: Unexpected token 'export' (at webamp:27:337238)

which aligns with the final statement in your non-minified webamp file:

...
window.Webamp = Webamp;
export {Webamp as default};
//# sourceMappingURL=webamp.bundle.min.mjs.map

I've instantiated webamp like this locally, following your PRs:

<script type="module">
      import Webamp from "https://unpkg.com/webamp@^2";
      const webamp = new Webamp({
        availableSkins: [
            {
              url: "https://archive.org/cors/winampskin_Green-Dimension-V2/Green-Dimension-V2.wsz",
              name: "Green Dimension V2",
            },
            {
              url: "https://archive.org/cors/winampskin_mac_os_x_1_5-aqua/mac_os_x_1_5-aqua.wsz",
              name: "Mac OSX v1.5 (Aqua)",
            },
        ],
        initialTracks: [
          {
            metaData: {
              artist: "Trammell Starks",
              title: "Fair Weather",
            },
            url: "https://ia902804.us.archive.org/26/items/weatherscancompletecollection/01%20Fair%20Weather.mp3",
            duration: 260
          },
         ...
        ],
      });
       webamp.renderWhenReady(document.getElementById("app"));
  </script>

and previously it was instantiated as:

<div id="app"></div>
<script src="https://unpkg.com/webamp"></script>
<script>
      const app = document.getElementById("app")
      const webamp = new Webamp({
        availableSkins: [
            {
              url: "https://archive.org/cors/winampskin_Green-Dimension-V2/Green-Dimension-V2.wsz",
              name: "Green Dimension V2",
            },
            {
              url: "https://archive.org/cors/winampskin_mac_os_x_1_5-aqua/mac_os_x_1_5-aqua.wsz",
              name: "Mac OSX v1.5 (Aqua)",
            },
        ],
        initialTracks: [
          {
            metaData: {
              artist: "Trammell Starks",
              title: "Fair Weather",
            },
            url: "https://ia902804.us.archive.org/26/items/weatherscancompletecollection/01%20Fair%20Weather.mp3",
            duration: 260
          },
         ...
        ],
      });
      webamp.renderWhenReady(app);
  </script>

You can see the "live errors" here: https://mwood77.github.io/ws4kp-international

And the deployed code here: https://github.com/mwood77/ws4kp-international/blob/97d1d22a6bf6a5c465c517ec67d3b758a675972e/views/index.ejs#L207-L210

Can you provide any insight?

Nevermind, I was able to track this down and fix it. I think I might've left a duplicate script tag on my first couple tries.