Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bug: bundling issue with vite #56

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

rburgst
Copy link

@rburgst rburgst commented Sep 14, 2021

  • 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
    

}

- the sample is missing 3 modules
  in order to play the configured
  video
- 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
}
  ```
@ludioao
Copy link

ludioao commented Mar 8, 2023

hey @rburgst you solved this issue?

@rburgst
Copy link
Author

rburgst commented Mar 10, 2023

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));
...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants