clappr / clappr-level-selector-plugin

Clappr Level Selector Plugin
MIT License
76 stars 56 forks source link

include plugin in ES6 project #57

Closed maxlapshin closed 4 years ago

maxlapshin commented 7 years ago

I'm using clappr as a library to my project, where I include clappr, some other plugins and my own code and produce single js output.

It is rather tricky to add level-selector there. Here are my steps:

1) add to package json direct github link:

  "dependencies": {
    "clappr": "0.2.71",
    "level-selector": "github:clappr/clappr-level-selector-plugin#0.1.10",
    "clappr-rtmp": "^0.0.19",
    "clappr-stats": "^0.1.2"
  }

next problem is with adding it to my code. I want to write in my index.js:

import LevelSelector from 'level-selector'

but it don't work stopping with:

ERROR in ./node_modules/level-selector/src/public/style.scss
Module parse failed: /Users/max/Sites/flussonic/wwwroot/flussonic_player/node_modules/level-selector/src/public/style.scss Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
| .level_selector[data-level-selector] {
|   float: right;
|   margin-top: 5px;
 @ ./node_modules/level-selector/src/main.js 3:0-45
 @ ./node_modules/level-selector/index.js
 @ ./src/index.js

I had to change import to:

import LevelSelector from '../node_modules/level-selector/dist/level-selector.js'

now it works.

I suppose that this is not good.

kslimani commented 7 years ago

This issue is due to package.json main field which is not pointing to dist ES5 version.

joaopaulovieira commented 4 years ago

Seems this is resolved on #48. Closing this issue and if it's not resolved, update here @maxlapshin