Video.js and official libraries and plugins work in a Webpack-based build environment, however some configuration may be needed to ensure code that is executed in workers is not broken by transpilation.
The solutions documented by the Mapbox project apply:
- Either set the production
browserslist
to
">0.2%",
"not dead",
"not op_mini all",
"not safari < 10",
"not chrome < 51",
"not android < 5",
"not ie < 12"
- Or import using the ! syntax
import videojs from "!video.js";
You may need to add style-loader
to your Webpack configuration.
Then add the CSS that the player requires, add the following to the file where the player is also included or initialized:
require('!style-loader!css-loader!video.js/dist/video-js.css')