您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

webpack.config.js 3.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. noParse: [
  54. // Do not parse the files of the Strophe.js library or at least
  55. // parts of the properties of the Strophe global variable will be
  56. // missing and strophejs-plugins will fail at runtime.
  57. strophe
  58. ]
  59. },
  60. node: {
  61. // Allow the use of the real filename of the module being executed. By
  62. // default Webpack does not leak path-related information and provides a
  63. // value that is a mock (/index.js).
  64. __filename: true
  65. },
  66. output: {
  67. filename: '[name]' + (minimize ? '.min' : '') + '.js',
  68. libraryTarget: 'umd',
  69. path: __dirname + '/build',
  70. sourceMapFilename: '[name].' + (minimize ? 'min' : 'js') + '.map'
  71. },
  72. resolve: {
  73. alias: {
  74. aui:
  75. '@atlassian/aui/dist/aui/js/aui'
  76. + (minimize ? '.min' : '')
  77. + '.js',
  78. 'aui-experimental':
  79. '@atlassian/aui/dist/aui/js/aui-experimental'
  80. + (minimize ? '.min' : '')
  81. + '.js',
  82. jquery: 'jquery/dist/jquery' + (minimize ? '.min' : '') + '.js',
  83. 'jQuery-Impromptu':
  84. 'jQuery-Impromptu/dist/jquery-impromptu'
  85. + (minimize ? '.min' : '')
  86. + '.js',
  87. },
  88. packageAlias: 'browser'
  89. }
  90. };
  91. module.exports = [
  92. // The Webpack configuration to bundle app.bundle.js (aka APP).
  93. Object.assign({}, config, {
  94. entry: {
  95. 'app.bundle': './app.js'
  96. },
  97. output: Object.assign({}, config.output, {
  98. library: 'APP'
  99. })
  100. }),
  101. // The Webpack configuration to bundle external_api.js (aka
  102. // JitsiMeetExternalAPI).
  103. Object.assign({}, config, {
  104. entry: {
  105. 'external_api': './modules/API/external/external_api.js'
  106. },
  107. output: Object.assign({}, config.output, {
  108. library: 'JitsiMeetExternalAPI'
  109. })
  110. })
  111. ];