modified lib-jitsi-meet dev repo
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

webpack.config.js 2.8KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. /* global __dirname */
  2. const process = require('process');
  3. const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
  4. const analyzeBundle = process.argv.indexOf('--analyze-bundle') !== -1;
  5. const minimize
  6. = process.argv.indexOf('-p') !== -1
  7. || process.argv.indexOf('--optimize-minimize') !== -1;
  8. const config = {
  9. devtool: 'source-map',
  10. mode: minimize ? 'production' : 'development',
  11. module: {
  12. rules: [ {
  13. // Version this build of the lib-jitsi-meet library.
  14. loader: 'string-replace-loader',
  15. options: {
  16. flags: 'g',
  17. replace:
  18. process.env.LIB_JITSI_MEET_COMMIT_HASH || 'development',
  19. search: '{#COMMIT_HASH#}'
  20. },
  21. test: `${__dirname}/JitsiMeetJS.js`
  22. }, {
  23. // Transpile ES2015 (aka ES6) to ES5.
  24. exclude: [
  25. new RegExp(`${__dirname}/node_modules/(?!js-utils)`)
  26. ],
  27. loader: 'babel-loader',
  28. options: {
  29. presets: [
  30. [
  31. '@babel/preset-env',
  32. // Tell babel to avoid compiling imports into CommonJS
  33. // so that webpack may do tree shaking.
  34. { modules: false }
  35. ],
  36. '@babel/preset-flow'
  37. ],
  38. plugins: [
  39. '@babel/plugin-transform-flow-strip-types',
  40. '@babel/plugin-proposal-class-properties',
  41. '@babel/plugin-proposal-export-namespace-from'
  42. ]
  43. },
  44. test: /\.js$/
  45. } ]
  46. },
  47. node: {
  48. // Allow the use of the real filename of the module being executed. By
  49. // default Webpack does not leak path-related information and provides a
  50. // value that is a mock (/index.js).
  51. __filename: true
  52. },
  53. optimization: {
  54. concatenateModules: minimize
  55. },
  56. output: {
  57. // eslint-disable-next-line
  58. filename: `[name]${true ? '.min' : ''}.js`,
  59. path: process.cwd(),
  60. // eslint-disable-next-line
  61. sourceMapFilename: `[name].${true ? 'min' : 'js'}.map`
  62. },
  63. performance: {
  64. hints: minimize ? 'error' : false,
  65. maxAssetSize: 750 * 1024,
  66. maxEntrypointSize: 750 * 1024
  67. },
  68. plugins: [
  69. analyzeBundle
  70. && new BundleAnalyzerPlugin({
  71. analyzerMode: 'disabled',
  72. generateStatsFile: true
  73. })
  74. ].filter(Boolean)
  75. };
  76. module.exports = [
  77. Object.assign({}, config, {
  78. entry: {
  79. 'lib-jitsi-meet': './index.js'
  80. },
  81. output: Object.assign({}, config.output, {
  82. library: 'JitsiMeetJS',
  83. libraryTarget: 'umd'
  84. })
  85. })
  86. ];