Skip to content

Commit

Permalink
feat(FEC-10347): expose kaltura player as a global variable instead o…
Browse files Browse the repository at this point in the history
…f UMD (#350)

Build Kaltura Player twice:
    - as 'var' - for run time
    - as 'commonjs2' for plugins unit tests

Solves FEC-10347

BREAKING CHANGE: kaltura-player is not UMD anymore
  • Loading branch information
yairans committed Sep 8, 2020
1 parent 08e5380 commit b6253ff
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
"url": "https://github.com/kaltura/kaltura-player-js"
},
"license": "AGPL-3.0",
"main": "dist/kaltura-ovp-player.js",
"main": "dist/kaltura-ovp-player.cjs.js",
"scripts": {
"build:ott": "sh ./scripts/job.sh build ott",
"build:ovp": "sh scripts/job.sh build ovp",
Expand Down
15 changes: 12 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,16 @@ const playerType = process.env.PLAYER_TYPE || 'ovp';
const playerFileType = playerType === 'ovp' ? 'ovp' : 'tv';

module.exports = (env, argv) => {
const configs = [
createConfig(env, argv, 'var')
];
if (argv.mode === 'production') {
configs.push(createConfig(env, argv, 'commonjs2'));
}
return configs;
};

function createConfig(env, argv, target) {
const isProd = argv.mode === 'production';
const plugins = [
new webpack.DefinePlugin({
Expand Down Expand Up @@ -55,10 +65,9 @@ module.exports = (env, argv) => {
},
output: {
path: __dirname + '/dist',
filename: '[name].js',
filename: `[name]${target === 'commonjs2' ? '.cjs' : ''}.js`,
library: 'KalturaPlayer',
libraryTarget: 'umd',
umdNamedDefine: true,
libraryTarget: target,
devtoolModuleFilenameTemplate: './kaltura-player/[resource-path]'
},
devtool: 'source-map',
Expand Down

0 comments on commit b6253ff

Please sign in to comment.