webpack.config.js 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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: /\.s[ac]ss$/, loader: 'style-loader!css-loader!sass-loader' },
  37. { test: /\.css$/, loader: 'style-loader!css-loader' },
  38. { test: /\.(woff2?|ttf|eot|svg)$/, loader: 'file-loader' },
  39. {
  40. test: /\.jsx?$/,
  41. exclude: /node_modules/,
  42. loader: 'babel-loader'
  43. },
  44. {
  45. test: /\.vue$/,
  46. loader: 'vue-loader',
  47. options: {
  48. shadowMode: true,
  49. loaders: {
  50. less: ['vue-style-loader', 'css-loader', 'less-loader', 'sass-loader']
  51. }
  52. }
  53. }
  54. ]
  55. },
  56. optimization: {
  57. //minimize: true,
  58. minimize: false,
  59. splitChunks: {
  60. chunks: 'all'
  61. },
  62. runtimeChunk: {
  63. name: 'hue'
  64. }
  65. },
  66. output: {
  67. path: __dirname + '/desktop/core/src/desktop/static/desktop/js/bundles/hue',
  68. filename: '[name]-bundle-[hash].js',
  69. chunkFilename: '[name]-chunk-[hash].js'
  70. },
  71. performance: {
  72. maxEntrypointSize: 400 * 1024, // 400kb
  73. maxAssetSize: 400 * 1024 // 400kb
  74. },
  75. plugins: getPluginConfig(BUNDLES.HUE),
  76. resolve: {
  77. extensions: ['.json', '.jsx', '.js', '.tsx', '.ts', '.vue'],
  78. modules: ['node_modules', 'js'],
  79. alias: {
  80. bootstrap: __dirname + '/node_modules/bootstrap-2.3.2/js',
  81. vue$: __dirname + '/node_modules/vue/dist/vue.esm.browser.min.js'
  82. }
  83. }
  84. };