Question: mux-player without hls.js bundled? #1033
-
Hello, We use hls.js library in our app already. But we are experimenting with migrating to using mux-player. Using the npm package however increases our bundle sizes significantly. I suspect this is because of the bundled hls.js library but we already use hls.js from cdn. Is there a version of mux-player which is decoupled with hls.js and the two libraries then can be loaded separately? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Here are all our dist builds: Using import maps you should be able to direct the package imports to the urls of your choice. I put together an example here: https://codesandbox.io/p/sandbox/8xgx86?file=%2Findex.html%3A17%2C77 Note that I wouldn't use this in production because of the many package requests it has to make. A better solution would be to NPM install Mux player in a project, then import the Hope this helps! |
Beta Was this translation helpful? Give feedback.
Here are all our dist builds:
https://cdn.jsdelivr.net/npm/@mux/mux-player@3.2.0/dist/
Using import maps you should be able to direct the package imports to the urls of your choice.
I put together an example here: https://codesandbox.io/p/sandbox/8xgx86?file=%2Findex.html%3A17%2C77
Note that I wouldn't use this in production because of the many package requests it has to make.
A better solution would be to NPM install Mux player in a project, then import the
/dist/index.mjs
path in your entry file and make thehls.js
import an external package (https://esbuild.github.io/api/#external). This will make that import not be resolved and not included in the bundle. Bundle everything, host the …