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.babel.js 3.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. import path from 'path';
  2. import process from 'process';
  3. import webpack from 'webpack';
  4. const aui_css
  5. = path.resolve(__dirname, './node_modules/@atlassian/aui/dist/aui/css/');
  6. const minimize
  7. = process.argv.indexOf('-p') != -1
  8. || process.argv.indexOf('--optimize-minimize') != -1;
  9. const strophe = /\/node_modules\/strophe(js-plugins)?\/.*\.js$/;
  10. // The base Webpack configuration to bundle the JavaScript artifacts of
  11. // jitsi-meet such as app.bundle.js and external_api.js.
  12. const config = {
  13. devtool: 'source-map',
  14. module: {
  15. loaders: [{
  16. // Transpile ES2015 (aka ES6) to ES5.
  17. exclude: [
  18. path.resolve(__dirname, './modules/RTC/adapter.screenshare.js'),
  19. path.resolve(__dirname, './node_modules/')
  20. ],
  21. loader: 'babel',
  22. test: /\.js$/
  23. },{
  24. // Expose jquery as the globals $ and jQuery because it is expected
  25. // to be available in such a form by multiple jitsi-meet
  26. // dependencies including AUI, lib-jitsi-meet.
  27. loader: 'expose?$!expose?jQuery',
  28. test: /\/node_modules\/jquery\/.*\.js$/
  29. },{
  30. // Disable AMD for the Strophe.js library or its imports will fail
  31. // at runtime.
  32. loader: 'imports?define=>false&this=>window',
  33. test: strophe
  34. },{
  35. // Allow CSS to be imported into JavaScript.
  36. loaders: [
  37. 'style',
  38. 'css'
  39. ],
  40. test: /\.css$/
  41. },{
  42. // Emit the static assets of AUI such as images that are referenced
  43. // by CSS into the output path.
  44. include: aui_css,
  45. loader: 'file',
  46. query: {
  47. context: aui_css,
  48. name: '[path][name].[ext]'
  49. },
  50. test: /\.(gif|png|svg)$/
  51. }],
  52. noParse: [
  53. // Do not parse the files of the Strophe.js library or at least
  54. // parts of the properties of the Strophe global variable will be
  55. // missing and strophejs-plugins will fail at runtime.
  56. strophe
  57. ]
  58. },
  59. node: {
  60. // Allow the use of the real filename of the module being executed. By
  61. // default Webpack does not leak path-related information and provides a
  62. // value that is a mock (/index.js).
  63. __filename: true
  64. },
  65. output: {
  66. filename: '[name]' + (minimize ? '.min' : '') + '.js',
  67. libraryTarget: 'umd',
  68. path: path.resolve(__dirname, './build'),
  69. sourceMapFilename: '[name].' + (minimize ? 'min' : 'js') + '.map'
  70. },
  71. resolve: {
  72. alias: {
  73. aui:
  74. '@atlassian/aui/dist/aui/js/aui'
  75. + (minimize ? '.min' : '')
  76. + '.js',
  77. 'aui-experimental':
  78. '@atlassian/aui/dist/aui/js/aui-experimental'
  79. + (minimize ? '.min' : '')
  80. + '.js',
  81. jquery: 'jquery/dist/jquery' + (minimize ? '.min' : '') + '.js',
  82. 'jQuery-Impromptu':
  83. 'jQuery-Impromptu/dist/jquery-impromptu'
  84. + (minimize ? '.min' : '')
  85. + '.js',
  86. },
  87. packageAlias: 'browser'
  88. }
  89. };
  90. export default [{
  91. // The Webpack configuration to bundle app.bundle.js (aka APP).
  92. ...config,
  93. entry: {
  94. 'app.bundle': './app.js'
  95. },
  96. output: {
  97. ...config.output,
  98. library: 'APP'
  99. }
  100. }, {
  101. // The Webpack configuration to bundle external_api.js (aka
  102. // JitsiMeetExternalAPI).
  103. ...config,
  104. entry: {
  105. 'external_api': './modules/API/external/external_api.js'
  106. },
  107. output: {
  108. ...config.output,
  109. library: 'JitsiMeetExternalAPI'
  110. }
  111. }];