webamp icon indicating copy to clipboard operation
webamp copied to clipboard

Importing Webamp from bundle inside a module

Open msikma opened this issue 2 years ago • 0 comments

The readme mentions how to get started with Webamp in two situations: minimal, and with webpack.

As I mentioned on Discord, the example links are actually 404, so I'm not sure what they look like. But there's a tertiary option that might be mentioned: minimal, but with a <script type="module"> tag. In this case, you need to import() Webamp:

<script type="module">
await import('./webamp.bundle-1.5.0.js')

const container = document.querySelector('#container')
const webamp = new Webamp()
await webamp.renderWhenReady(container)
</script>

It might be worth mentioning this since it's otherwise not totally straightforward how to use the bundle file in an environment where a module is required.

msikma avatar Oct 30 '23 15:10 msikma