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

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