dash.js icon indicating copy to clipboard operation
dash.js copied to clipboard

ESM module in dist/ folder

Open luwes opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

There is no ESM bundle available in the dist folder. https://cdn.jsdelivr.net/npm/[email protected]/dist/

This makes it harder to include Dash.js in some environments, and makes devs have to rely more on bundlers or build systems while modern browsers can import ESM without any bundler and most recently use import maps to alias.

Having to use window.dashjs is a quite outdated way to consume packages and pollutes the global scope.

Describe the solution you'd like

Provide an ESM bundle in the dist folder

Describe alternatives you've considered

I've created https://github.com/luwes/dashjs-esm especially for this so https://github.com/luwes/dash-video-element can import Dash.js without the need for a bundler / build system.

Additional context

I'm aware of https://github.com/Dash-Industry-Forum/dash-video-element which relies on window.dashjs. Ideally this would be an ESM import so the dependency is clear.

luwes avatar May 18 '23 18:05 luwes

@luwes Can you provide a PR for this? From my understanding, this can be integrated into our webpack configuration? Or as an alternative as a script command in npm build?

dsilhavy avatar May 30 '23 09:05 dsilhavy

I am addressing this in #4538. I appreciate any feedback on the PR as I am not sure if this is the best way to move forward.

The main idea is to output an ESM bundle in the dist/esm folder. The generation of the bundle is included in the webpack build workflow.

dsilhavy avatar Aug 05 '24 15:08 dsilhavy

Addressed in #4538 and #4543

dsilhavy avatar Aug 09 '24 09:08 dsilhavy