-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Remove outdated ad-insertion samples * Add new Webpack config to create a modern and a legacy build * Adjust path to dist files in samples and functional tests * Network interceptor sample - integrate dash.js bundle in sample app output bundle * Remove call to prebuild for "npm run build" to not trigger "prebuild" twice * Remove ESM bundle from legacy build * Remove any core.js polyfills from modern build * Adjust Github actions * Fix Github action * Add examples for the different builds and rename ESM build * Change dash.js dependency for Typescript and Webpack sample * Add an export for CommonJS using the "require" field --------- Co-authored-by: Bertrand Berthelot <[email protected]>
- Loading branch information
Showing
109 changed files
with
2,284 additions
and
1,884 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
defaults |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
const pkg = require('../../../package.json'); | ||
|
||
const commonBaseConfig = { | ||
devtool: 'source-map', | ||
module: { | ||
rules: [ | ||
{ | ||
test: /\.(js)$/, | ||
exclude: [/core-js/], | ||
use: [ | ||
{ | ||
loader: 'string-replace-loader', | ||
options: { | ||
search: '__VERSION__', | ||
replace: pkg.version, | ||
}, | ||
} | ||
], | ||
}, | ||
], | ||
}, | ||
resolve: { | ||
fallback: { | ||
stream: require.resolve('stream-browserify'), | ||
}, | ||
}, | ||
} | ||
|
||
const prodEntries = { | ||
'dash.all': './index.js', | ||
'dash.mss': './src/mss/index.js', | ||
'dash.mediaplayer': './index_mediaplayerOnly.js', | ||
'dash.protection': './src/streaming/protection/Protection.js', | ||
'dash.reporting': './src/streaming/metrics/MetricsReporting.js', | ||
'dash.offline': './src/offline/index.js' | ||
} | ||
|
||
const devEntries = { | ||
'dash.all': './index.js', | ||
'dash.mss': './src/mss/index.js', | ||
'dash.offline': './src/offline/index.js' | ||
} | ||
|
||
module.exports = { commonBaseConfig, prodEntries, devEntries }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
const EsLintWebpackPlugin = require('eslint-webpack-plugin'); | ||
const { prodEntries } = require('../common/webpack.common.base.cjs'); | ||
|
||
const plugins = [ | ||
new EsLintWebpackPlugin({ | ||
configType: 'flat', | ||
files: [ | ||
'src/**/*.js', | ||
'test/unit/mocks/*.js', | ||
'test/unit/test/**/*.js' | ||
] | ||
}) | ||
] | ||
|
||
const configCommonDebugProdUmd = { | ||
mode: 'development', | ||
entry: prodEntries, | ||
output: { | ||
filename: '[name].debug.js' | ||
} | ||
}; | ||
|
||
const configCommonMinProdUmd = { | ||
mode: 'production', | ||
entry: prodEntries, | ||
output: { | ||
filename: '[name].min.js' | ||
}, | ||
performance: { hints: false }, | ||
plugins | ||
}; | ||
|
||
const configCommonDebugProdEsm = { | ||
mode: 'development', | ||
entry: prodEntries, | ||
output: { | ||
filename: '[name].debug.js' | ||
} | ||
}; | ||
|
||
const configCommonMinProdEsm = { | ||
mode: 'production', | ||
entry: prodEntries, | ||
output: { | ||
filename: '[name].min.js' | ||
}, | ||
optimization: { | ||
usedExports: false, | ||
}, | ||
performance: { hints: false }, | ||
plugins | ||
}; | ||
|
||
module.exports = { configCommonDebugProdEsm, configCommonMinProdEsm, configCommonDebugProdUmd, configCommonMinProdUmd }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
const path = require('path'); | ||
const { merge } = require('webpack-merge'); | ||
const { commonBaseConfig } = require('../common/webpack.common.base.cjs'); | ||
|
||
const legacyConfig = merge(commonBaseConfig, { | ||
target: ['web', 'es5'] | ||
}); | ||
|
||
legacyConfig.module.rules[0].use.push({ | ||
loader: 'babel-loader', | ||
options: { | ||
sourceType: 'unambiguous', | ||
presets: [ | ||
[ | ||
'@babel/preset-env', | ||
{ | ||
useBuiltIns: 'usage', | ||
targets: { | ||
ie: '11', | ||
}, | ||
corejs: '3.39.0', | ||
} | ||
], | ||
], | ||
plugins: [ | ||
'@babel/plugin-transform-runtime', | ||
'@babel/plugin-transform-parameters' | ||
], | ||
}, | ||
},) | ||
|
||
const umdConfig = merge(legacyConfig, { | ||
output: { | ||
path: path.resolve(__dirname, '../../../dist/legacy/umd'), | ||
publicPath: '/dist/legacy/umd/', | ||
library: 'dashjs', | ||
libraryTarget: 'umd', | ||
libraryExport: 'default' | ||
}, | ||
}); | ||
|
||
module.exports = { umdConfig }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const { merge } = require('webpack-merge'); | ||
const { umdConfig } = require('./webpack.legacy.base.cjs'); | ||
const { | ||
configCommonDebugProdUmd, | ||
configCommonMinProdUmd | ||
} = require('../common/webpack.common.prod.cjs'); | ||
|
||
const configLegacyDebugUmd = merge(umdConfig, configCommonDebugProdUmd); | ||
|
||
const configLegacyMinUmd = merge(umdConfig, configCommonMinProdUmd); | ||
|
||
module.exports = [configLegacyDebugUmd, configLegacyMinUmd]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
const path = require('path'); | ||
const { merge } = require('webpack-merge'); | ||
const { commonBaseConfig } = require('../common/webpack.common.base.cjs'); | ||
|
||
const modernConfig = merge(commonBaseConfig, { | ||
target: ['browserslist'] | ||
}); | ||
|
||
modernConfig.module.rules[0].use.push({ | ||
loader: 'babel-loader', | ||
options: { | ||
sourceType: 'unambiguous', | ||
presets: [ | ||
[ | ||
'@babel/preset-env' | ||
], | ||
], | ||
plugins: [ | ||
'@babel/plugin-transform-runtime' | ||
], | ||
}, | ||
},) | ||
|
||
const umdConfig = merge(modernConfig, { | ||
output: { | ||
path: path.resolve(__dirname, '../../../dist/modern/umd'), | ||
publicPath: '/dist/modern/umd/', | ||
library: 'dashjs', | ||
libraryTarget: 'umd', | ||
libraryExport: 'default' | ||
}, | ||
}); | ||
|
||
const esmConfig = merge(modernConfig, { | ||
experiments: { | ||
outputModule: true | ||
}, | ||
output: { | ||
path: path.resolve(__dirname, '../../../dist/modern/esm'), | ||
publicPath: '/dist/modern/esm/', | ||
library: { | ||
type: 'module', | ||
}, | ||
libraryExport: 'default', | ||
}, | ||
}); | ||
|
||
module.exports = { umdConfig, esmConfig }; |
Oops, something went wrong.