xgplayer/packages/xgplayer-flv.js/webpack.config.js
2018-06-24 16:28:37 +08:00

78 lines
1.4 KiB
JavaScript

const polyfill = []
const umd = {
entry: polyfill.concat(['./src/index.js']),
output: {
path: `${__dirname}/dist`,
filename: 'index.js',
library: 'xgplayer-flv.js',
libraryTarget: 'umd'
},
mode: 'production',
module: {
rules: [{
test: /\.js$/,
loader: 'babel-loader'
}, {
test: /\.scss$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
importLoaders: 1,
minimize: true
}
},
'postcss-loader',
'sass-loader'
]
}]
},
externals: {
'xgplayer': 'xgplayer'
},
optimization: {
minimize: true
}
}
const client = {
entry: polyfill.concat(['./src/index.js']),
output: {
path: `${__dirname}/browser`,
filename: 'xgplayer-flvjs.js',
library: 'FlvJsPlayer',
libraryTarget: 'window'
},
module: {
rules: [{
test: /\.js$/,
loader: 'babel-loader'
}, {
test: /\.scss$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
importLoaders: 1,
minimize: true
}
},
'postcss-loader',
'sass-loader'
]
}]
},
externals: {
'xgplayer': 'Player'
},
mode: 'production',
optimization: {
minimize: true
}
}
module.exports = [umd, client]