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 4.0KB

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