Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

webpack.config.js 4.2KB

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