forked from video-dev/hls.js
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Use webpack to bundle hls.js with the exact same config - Use webpack-dev-server to run the demo-page - Use webpack's publicPath in demo/index.html - Add __VERSION__ as global in .jshintrc - Replace __VERSION__ at bundling - Remove useless devDependencies - Remove private attr - Move url-toolkit in dependencies
- Loading branch information
Showing
6 changed files
with
84 additions
and
40 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 |
---|---|---|
|
@@ -29,6 +29,7 @@ | |
"fetch" : true, | ||
"Request" : true, | ||
"Headers" : true, | ||
"escape" : true | ||
"escape" : true, | ||
"__VERSION__" : true | ||
} | ||
} |
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 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 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,62 @@ | ||
var pkgJson = require('./package.json') | ||
var path = require('path') | ||
var webpack = require('webpack') | ||
|
||
var env = process.env.NODE_ENV | ||
|
||
var config = { | ||
entry: './src/index.js', | ||
output: { | ||
path: path.resolve(__dirname, 'dist'), | ||
publicPath: '/assets/', | ||
library: 'Hls', | ||
libraryTarget: 'umd' | ||
}, | ||
devServer: { | ||
compress: true, | ||
contentBase: path.resolve(__dirname, 'demo') | ||
}, | ||
module: { | ||
rules: [{ | ||
test: /\.js$/, | ||
exclude: [ | ||
path.resolve(__dirname, 'node_modules') | ||
], | ||
loader: 'babel-loader', | ||
options: { | ||
presets: ['es2015'] | ||
} | ||
}] | ||
}, | ||
plugins: [ | ||
new webpack.optimize.OccurrenceOrderPlugin(), | ||
new webpack.DefinePlugin({ | ||
__VERSION__: JSON.stringify(pkgJson.version) | ||
}) | ||
] | ||
} | ||
|
||
if (env === 'production') { | ||
config.plugins.push( | ||
new webpack.optimize.UglifyJsPlugin({ | ||
compressor: { | ||
sequences: true, | ||
dead_code: true, | ||
conditionals: true, | ||
booleans: true, | ||
unused: true, | ||
if_return: true, | ||
join_vars: true, | ||
drop_console: true | ||
}, | ||
mangle: { | ||
screw_ie8: true | ||
}, | ||
output: { | ||
screw_ie8: true | ||
} | ||
}) | ||
) | ||
} | ||
|
||
module.exports = config |