SevenOutman / vue-aplayer

:cake: Easy-to-use music player for Vue 2.x
https://vue-aplayer.js.org
MIT License
1.32k stars 200 forks source link

hls.js warning ? #61

Open volkanciloglu opened 6 years ago

volkanciloglu commented 6 years ago

I installed the aplayer with the npm install method. all the settings are working ok so everything is working. but the console gives a warning and it's about hls.js. how can i solve it?

./node_modules/vue-aplayer/dist/vue-aplayer.min.js
Module not found: Error: Can't resolve 'hls.js' in 'C:\xampp\htdocs\sezenaksu\node_modules\vue-aplayer\dist'
 @ ./node_modules/vue-aplayer/dist/vue-aplayer.min.js 1:119-136
 @ ./src/main.js
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js
SevenOutman commented 6 years ago

@VCodepp Which version of Vue-APlayer are you using?

volkanciloglu commented 6 years ago

I see package-lock.json

"version": "1.6.0",

volkanciloglu commented 6 years ago

I did not add project hls.js. sorry is my mistake completely.

I tried $ npm install --save hls.js

and dismiss warn problem.

SevenOutman commented 6 years ago

@VCodepp Nah actually there's still problem with Vue-APlayer. hls.js is not a solid dependency of Vue-APlayer. It's only required if you want to play HLS media. And if you don't, everything still works fine without hls.js - silently without warning. So I still need to figure it out. Related line: https://github.com/SevenOutman/vue-aplayer/blob/develop/src/vue-aplayer.vue#L723

SevenOutman commented 6 years ago

@VCodepp A quick fix to this is adding hls.js to "externals" in your webpack config, like

{
  externals: 'hls.js'
}
volkanciloglu commented 6 years ago
????:{
  externals: 'hls.js'
}

sorry learning new VUE

SevenOutman commented 6 years ago

@VCodepp If you're using vue-cli, the webpack config file is in build/webpack.base.conf.js. Add an 'external' property to the exported object like:

module.exports = {
  entry: ...,
  output: ...,
+ externals: 'hls.js'
}
volkanciloglu commented 6 years ago

Ok thank for help .

ghost commented 6 years ago

+1, Same problem.

JqiangLiu commented 5 years ago

如果用externals把‘hls.js’去除,npm run dev下会报hls is not defined的错误。