Skip to content

Usage with webpack #4

@jide

Description

@jide

Hey,

I'm coming from hell, which is trying to make videojs-contrib-hls work with webpack videojs/videojs-contrib-hls#600, so I decided to give this module a try, and I was more lucky.

package.json should have a main entry pointing to the dist file, and in an ideal world dependencies to hls.js and video.js should be handled using the webpack standard factory function instead of relying on globals.

In the meantime, I thought I should put my working solution here :

npm i video.js@5
npm i videojs-hlsjs
npm i hlsjs.js
// webpack.config.js
{
  resolve: {
    alias: {
      'videojs-hlsjs': 'videojs-hlsjs/dist/videojs-hlsjs.js'
    },
  },

  plugins: [
    new webpack.ProvidePlugin({
      videojs: 'video.js',
      'window.videojs': 'video.js',
      'window.Hls': 'hls.js'
    })
  ]
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions