You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

webpack.config.js 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. /* global __dirname */
  2. const process = require('process');
  3. const webpack = require('webpack');
  4. const minimize
  5. = process.argv.indexOf('-p') !== -1
  6. || process.argv.indexOf('--optimize-minimize') !== -1;
  7. const plugins = [
  8. new webpack.LoaderOptionsPlugin({
  9. debug: !minimize,
  10. minimize
  11. })
  12. ];
  13. if (minimize) {
  14. plugins.push(new webpack.optimize.ModuleConcatenationPlugin());
  15. plugins.push(new webpack.optimize.UglifyJsPlugin({
  16. compress: {
  17. warnings: true
  18. },
  19. extractComments: true,
  20. sourceMap: true
  21. }));
  22. }
  23. module.exports = {
  24. devtool: 'source-map',
  25. entry: {
  26. 'lib-jitsi-meet': './index.js'
  27. },
  28. module: {
  29. rules: [ {
  30. // Version this build of the lib-jitsi-meet library.
  31. loader: 'string-replace-loader',
  32. options: {
  33. flags: 'g',
  34. replace:
  35. process.env.LIB_JITSI_MEET_COMMIT_HASH || 'development',
  36. search: '{#COMMIT_HASH#}'
  37. },
  38. test: `${__dirname}/JitsiMeetJS.js`
  39. }, {
  40. // Transpile ES2015 (aka ES6) to ES5.
  41. exclude: [
  42. `${__dirname}/modules/RTC/adapter.screenshare.js`,
  43. `${__dirname}/node_modules/`
  44. ],
  45. loader: 'babel-loader',
  46. options: {
  47. presets: [
  48. [
  49. 'env',
  50. // Tell babel to avoid compiling imports into CommonJS
  51. // so that webpack may do tree shaking.
  52. { modules: false }
  53. ],
  54. 'stage-1'
  55. ]
  56. },
  57. test: /\.js$/
  58. } ]
  59. },
  60. node: {
  61. // Allow the use of the real filename of the module being executed. By
  62. // default Webpack does not leak path-related information and provides a
  63. // value that is a mock (/index.js).
  64. __filename: true
  65. },
  66. output: {
  67. filename: `[name]${minimize ? '.min' : ''}.js`,
  68. library: 'JitsiMeetJS',
  69. libraryTarget: 'umd',
  70. sourceMapFilename: `[name].${minimize ? 'min' : 'js'}.map`
  71. },
  72. plugins
  73. };