webpack.config.js 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  1. // Licensed to Cloudera, Inc. under one
  2. // or more contributor license agreements. See the NOTICE file
  3. // distributed with this work for additional information
  4. // regarding copyright ownership. Cloudera, Inc. licenses this file
  5. // to you under the Apache License, Version 2.0 (the
  6. // "License"); you may not use this file except in compliance
  7. // with the License. You may obtain a copy of the License at
  8. //
  9. // http://www.apache.org/licenses/LICENSE-2.0
  10. //
  11. // Unless required by applicable law or agreed to in writing, software
  12. // distributed under the License is distributed on an "AS IS" BASIS,
  13. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14. // See the License for the specific language governing permissions and
  15. // limitations under the License.
  16. const { BUNDLES, getPluginConfig } = require('./desktop/core/src/desktop/js/webpack/configUtils');
  17. module.exports = {
  18. devtool: false,
  19. entry: {
  20. hue: ['./desktop/core/src/desktop/js/hue.js'],
  21. notebook: ['./desktop/core/src/desktop/js/apps/notebook/app.js'],
  22. tableBrowser: ['./desktop/core/src/desktop/js/apps/tableBrowser/app.js'],
  23. jobBrowser: ['./desktop/core/src/desktop/js/apps/jobBrowser/app.js']
  24. },
  25. mode: 'development',
  26. module: {
  27. rules: [
  28. {
  29. test: /\.tsx?$/,
  30. exclude: /node_modules/,
  31. loader: 'babel-loader'
  32. },
  33. { test: /\.js$/, use: ['source-map-loader'], enforce: 'pre' },
  34. { test: /\.(html)$/, loader: 'html?interpolate&removeComments=false' },
  35. { test: /\.less$/, loader: 'style-loader!css-loader!less-loader' },
  36. { test: /\.css$/, loader: 'style-loader!css-loader' },
  37. { test: /\.(woff2?|ttf|eot|svg)$/, loader: 'file-loader' },
  38. {
  39. test: /\.jsx?$/,
  40. exclude: /node_modules/,
  41. loader: 'babel-loader'
  42. },
  43. {
  44. test: /\.vue$/,
  45. loader: 'vue-loader',
  46. options: {
  47. loaders: {
  48. less: ['vue-style-loader', 'css-loader', 'less-loader']
  49. }
  50. }
  51. }
  52. ]
  53. },
  54. optimization: {
  55. //minimize: true,
  56. minimize: false,
  57. splitChunks: {
  58. chunks: 'all'
  59. },
  60. runtimeChunk: {
  61. name: 'hue'
  62. }
  63. },
  64. output: {
  65. path: __dirname + '/desktop/core/src/desktop/static/desktop/js/bundles/hue',
  66. filename: '[name]-bundle-[hash].js',
  67. chunkFilename: '[name]-chunk-[hash].js'
  68. },
  69. performance: {
  70. maxEntrypointSize: 400 * 1024, // 400kb
  71. maxAssetSize: 400 * 1024 // 400kb
  72. },
  73. plugins: getPluginConfig(BUNDLES.HUE),
  74. resolve: {
  75. extensions: ['.json', '.jsx', '.js', '.tsx', '.ts', '.vue'],
  76. modules: ['node_modules', 'js'],
  77. alias: {
  78. bootstrap: __dirname + '/node_modules/bootstrap-2.3.2/js',
  79. vue$: __dirname + '/node_modules/vue/dist/vue.esm.browser.min.js'
  80. }
  81. }
  82. };