modified lib-jitsi-meet dev repo
Du kan inte välja fler än 25 ämnen Ämnen måste starta med en bokstav eller siffra, kan innehålla bindestreck ('-') och vara max 35 tecken långa.

webpack.config.js 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  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. filename: `[name]${minimize ? '.min' : ''}.js`,
  58. path: process.cwd(),
  59. sourceMapFilename: `[name].${minimize ? 'min' : 'js'}.map`
  60. },
  61. performance: {
  62. hints: minimize ? 'error' : false,
  63. maxAssetSize: 750 * 1024,
  64. maxEntrypointSize: 750 * 1024
  65. },
  66. plugins: [
  67. analyzeBundle
  68. && new BundleAnalyzerPlugin({
  69. analyzerMode: 'disabled',
  70. generateStatsFile: true
  71. })
  72. ].filter(Boolean)
  73. };
  74. module.exports = [
  75. Object.assign({}, config, {
  76. entry: {
  77. 'lib-jitsi-meet': './index.js'
  78. },
  79. output: Object.assign({}, config.output, {
  80. library: 'JitsiMeetJS',
  81. libraryTarget: 'umd'
  82. })
  83. })
  84. ];