webpack.config.js 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 {
  17. BUNDLES,
  18. getPluginConfig,
  19. splitChunksName
  20. } = require('./desktop/core/src/desktop/js/webpack/configUtils');
  21. module.exports = {
  22. devtool: false,
  23. entry: {
  24. hue: ['./desktop/core/src/desktop/js/hue.js'],
  25. notebook: ['./desktop/core/src/desktop/js/apps/notebook/app.js'],
  26. tableBrowser: ['./desktop/core/src/desktop/js/apps/tableBrowser/app.js'],
  27. jobBrowser: ['./desktop/core/src/desktop/js/apps/jobBrowser/app.js']
  28. },
  29. mode: 'development',
  30. module: {
  31. rules: [
  32. {
  33. test: /\.tsx?$/,
  34. exclude: /node_modules/,
  35. loader: 'babel-loader'
  36. },
  37. { test: /\.js$/, use: ['source-map-loader'], enforce: 'pre' },
  38. { test: /\.(html)$/, loader: 'html?interpolate&removeComments=false' },
  39. { test: /\.less$/, loader: 'style-loader!css-loader!less-loader' },
  40. { test: /\.s[ac]ss$/, loader: 'style-loader!css-loader!sass-loader' },
  41. { test: /\.css$/, loader: 'style-loader!css-loader' },
  42. { test: /\.(woff2?|ttf|eot|svg)$/, loader: 'file-loader' },
  43. {
  44. test: /\.jsx?$/,
  45. exclude: /node_modules/,
  46. loader: 'babel-loader'
  47. },
  48. {
  49. test: /\.vue$/,
  50. loader: 'vue-loader',
  51. options: {
  52. shadowMode: true,
  53. loaders: {
  54. less: ['vue-style-loader', 'css-loader', 'less-loader', 'sass-loader']
  55. }
  56. }
  57. }
  58. ]
  59. },
  60. optimization: {
  61. //minimize: true,
  62. minimize: false,
  63. splitChunks: {
  64. chunks: 'all',
  65. name: splitChunksName
  66. },
  67. runtimeChunk: {
  68. name: 'hue'
  69. }
  70. },
  71. output: {
  72. path: __dirname + '/desktop/core/src/desktop/static/desktop/js/bundles/hue',
  73. filename: '[name]-bundle-[hash].js',
  74. chunkFilename: '[name]-chunk-[hash].js'
  75. },
  76. performance: {
  77. maxEntrypointSize: 400 * 1024, // 400kb
  78. maxAssetSize: 400 * 1024 // 400kb
  79. },
  80. plugins: getPluginConfig(BUNDLES.HUE),
  81. resolve: {
  82. extensions: ['.json', '.jsx', '.js', '.tsx', '.ts', '.vue'],
  83. modules: ['node_modules', 'js'],
  84. alias: {
  85. bootstrap: __dirname + '/node_modules/bootstrap-2.3.2/js',
  86. vue$: __dirname + '/node_modules/vue/dist/vue.esm.browser.min.js'
  87. }
  88. }
  89. };