openplayerjs: Uncaught TypeError: n(...).default is not a constructor, using TypeScript

Describe the bug Uncaught TypeError: n(…).default is not a constructor

To Reproduce I’ll provide a reproducer if bug cannot be solved easily but basically, I’m using the player in a contentscript.ts used in web extension development.

the tsconfig.json

{
  "compilerOptions": {
      "module": "commonjs",
      "target": "es5",
      "noImplicitAny": true,
      "noImplicitUseStrict": true,
      "noImplicitReturns": true,
      "strictNullChecks": true,
      "lib": ["dom", "es2017"]
  }
}

.babelrc

{
  "presets": [
    ["env", {
      "targets": {
        "browsers": "last 2 versions"
      }
    }]
  ],
  "ignore": ["node_modules"]
}

Code generating the error. I’m using the master branch.

import OpenPlayerJS from 'openplayerjs';
const player = new OpenPlayerJS('vokatic-player', '...');

Expected behavior To not error.

Screenshots the compiled code image

Desktop (please complete the following information):

  • OS: Linux
  • Browser: Chrome

Additional context I’m planning to use your player to vocalize news content, it’s done through a web extension for testing purpose right now.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 19 (11 by maintainers)

Commits related to this issue

Most upvoted comments

OK, I’m on it !

already done 😉