modified lib-jitsi-meet dev repo
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

webpack-shared-config.js 3.1KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /* global __dirname */
  2. const process = require('process');
  3. const { ProvidePlugin } = require('webpack');
  4. const { BundleAnalyzerPlugin } = require('webpack-bundle-analyzer');
  5. module.exports = (minimize, analyzeBundle) => {
  6. return {
  7. // The inline-source-map is used to allow debugging the unit tests with Karma
  8. devtool: minimize ? 'source-map' : 'inline-source-map',
  9. mode: minimize ? 'production' : 'development',
  10. module: {
  11. rules: [ {
  12. // Version this build of the lib-jitsi-meet library.
  13. loader: 'string-replace-loader',
  14. options: {
  15. flags: 'g',
  16. replace:
  17. process.env.LIB_JITSI_MEET_COMMIT_HASH || 'development',
  18. search: '{#COMMIT_HASH#}'
  19. },
  20. test: `${__dirname}/JitsiMeetJS.js`
  21. }, {
  22. // Transpile ES2015 (aka ES6) to ES5.
  23. exclude: [
  24. new RegExp(`${__dirname}/node_modules/(?!@jitsi/js-utils)`)
  25. ],
  26. loader: 'babel-loader',
  27. options: {
  28. presets: [
  29. [
  30. '@babel/preset-env',
  31. // Tell babel to avoid compiling imports into CommonJS
  32. // so that webpack may do tree shaking.
  33. {
  34. modules: false,
  35. // Specify our target browsers so no transpiling is
  36. // done unnecessarily. For browsers not specified
  37. // here, the ES2015+ profile will be used.
  38. targets: {
  39. chrome: 80,
  40. electron: 10,
  41. firefox: 68,
  42. safari: 14
  43. }
  44. }
  45. ]
  46. ]
  47. },
  48. test: /\.js$/
  49. } ]
  50. },
  51. node: {
  52. // Allow the use of the real filename of the module being executed. By
  53. // default Webpack does not leak path-related information and provides a
  54. // value that is a mock (/index.js).
  55. __filename: true
  56. },
  57. optimization: {
  58. concatenateModules: minimize
  59. },
  60. output: {
  61. filename: `[name]${minimize ? '.min' : ''}.js`,
  62. sourceMapFilename: `[name].${minimize ? 'min' : 'js'}.map`
  63. },
  64. performance: {
  65. hints: minimize ? 'error' : false,
  66. maxAssetSize: 750 * 1024,
  67. maxEntrypointSize: 750 * 1024
  68. },
  69. plugins: [
  70. analyzeBundle
  71. && new BundleAnalyzerPlugin({
  72. analyzerMode: 'disabled',
  73. generateStatsFile: true
  74. }),
  75. !minimize
  76. && new ProvidePlugin({
  77. process: 'process/browser'
  78. })
  79. ].filter(Boolean)
  80. };
  81. };