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.6KB

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