@skylineos/videojs-clsp
Version:
Video JS plugin for Skyline Technology Solutions' CLSP Player - https://github.com/skylineos/clsp-player
53 lines (44 loc) • 1.48 kB
JavaScript
;
const webpack = require('webpack');
const BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin;
const webpackConfigs = require('./webpack.common');
const proConfig = (webpackConfig) => {
const config = {
...webpackConfig,
mode: 'production',
cache: true,
// @todo - minimization breaks the plugin and player!
optimization: {
minimize: false,
},
plugins: [
...webpackConfig.plugins,
new webpack.DefinePlugin({
// This is needed to ensure that things like react and redux compile and
// minify properly - if you need access to this in code, use
// global.app.environment instead.
'process.env': {
NODE_ENV: JSON.stringify('production'),
},
// Needed to prevent minification breaking video-contrib-hls
// @see - https://github.com/videojs/videojs-contrib-hls/issues/600#issuecomment-321281442
'typeof global': JSON.stringify('undefined'),
}),
],
};
if (process.env.ANALYZE_BUILD) {
config.plugins.push(new BundleAnalyzerPlugin({
analyzerMode: 'static',
}));
}
config.output.filename = '[name].min.js';
return config;
};
module.exports = function () {
const configs = webpackConfigs().map((webpackConfig) => proConfig(webpackConfig));
// We ONLY want the CLSP VideoJS Plugin to be built in prod mode
// Discard all the demo configs
return [
configs.pop(),
];
};