bitmovin-player-web-samples icon indicating copy to clipboard operation
bitmovin-player-web-samples copied to clipboard

bug: bundling issue with `vite`

Open rburgst opened this issue 2 years ago • 2 comments

  • this PR shows a bug where bundling with vite (which uses rollup under the hood) causes issues when using the modular player
  • to repro do the following
    npm run build
    npm run serve
    
  • access the server at http://localhost:5000/
  • check the error in the browser console
    {
      "code": 3001,
      "name": "MODULE_INVALID_DEFINITION",
      "message": "Missing name",
      "data": null
    

}

rburgst avatar Sep 14 '21 15:09 rburgst

hey @rburgst you solved this issue?

ludioao avatar Mar 08 '23 23:03 ludioao

we fixed it by using the following function

function getModuleExport(module: unknown): unknown {
    if (isObject(module) && 'default' in module) {
        return module.default;
    }
    return module;
}

...
    Player.addModule(getModuleExport(MP4ContainerModule));
...

rburgst avatar Mar 10 '23 11:03 rburgst