smnbbrv / ngx-plyr

Angular 6+ binding for Plyr video & audio player
https://smnbbrv.github.io/ngx-plyr/
MIT License
100 stars 65 forks source link

plyr has no default export #34

Closed jeffaribeiro closed 4 years ago

jeffaribeiro commented 4 years ago

Hello!

After installing and configuring ngx-plyr, as explained in the documentation and the Stackblitz example, I was not successful. The following error occurs:

ERROR in node_modules/ngx-plyr/lib/plyr-driver/plyr-driver.d.ts:1:8 - error TS1192: Module '"D:/source/repos/MuradJazzPiano/node_modules/plyr/src/js/plyr"' has no default export.

1 import Plyr from 'plyr';


node_modules/ngx-plyr/lib/plyr/plyr.component.d.ts:2:8 - error TS1192: Module '"D:/source/repos/MuradJazzPiano/node_modules/plyr/src/js/plyr"' has no default export.

2 import Plyr from 'plyr';

### My package.json:

{
  "name": "murad-jazz-piano",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~8.0.1",
    "@angular/common": "~8.0.1",
    "@angular/compiler": "~8.0.1",
    "@angular/core": "~8.0.1",
    "@angular/forms": "~8.0.1",
    "@angular/platform-browser": "~8.0.1",
    "@angular/platform-browser-dynamic": "~8.0.1",
    "@angular/router": "~8.0.1",
    "hls.js": "^0.13.2",
    "ngx-plyr": "^3.0.1",
    "plyr": "^3.5.10",
    "rxjs": "~6.4.0",
    "tslib": "^1.11.1",
    "videogular2": "^7.0.1",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "0.803.24",
    "@angular/cli": "~8.0.3",
    "@angular/compiler-cli": "~8.0.1",
    "@angular/language-service": "~8.0.1",
    "@types/node": "~8.9.4",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.4.3"
  }
}

### I believe a file is missing a 'Plyr' export, right?
haladamateusz commented 4 years ago

Go to yours config.json and type:

"CompilerOptions": {
...
"allowSyntheticDefaultImports": true, 
...
}
jeffaribeiro commented 4 years ago

I solved the problem by adding

import * as Plyr of 'plyr';

in the files

\ node_modules \ ngx-plyr \ lib \ plyr \ plyr.component.d.ts
\ node_modules \ ngx-plyr \ lib \ driver plyr \ driver plyr.d.ts
smnbbrv commented 4 years ago

I triggered the discussion here https://github.com/sampotts/plyr/pull/1521#issuecomment-597629466

Let's see whether we would need to switch to the import * as Plyr of 'plyr'; in the future.

smnbbrv commented 4 years ago

Using import * as Plyr of 'plyr'; in combination with v4.0.0 should solve the issue