webpack.config.workers.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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 CleanWebpackPlugin = require('clean-webpack-plugin');
  17. const {
  18. BUNDLES,
  19. getPluginConfig,
  20. splitChunksName
  21. } = require('./desktop/core/src/desktop/js/webpack/configUtils');
  22. const shared = require('./webpack.config');
  23. module.exports = {
  24. devtool: shared.devtool,
  25. mode: shared.mode,
  26. target: 'webworker',
  27. performance: shared.performance,
  28. resolve: shared.resolve,
  29. entry: {
  30. sqlLocationWebWorker: ['./desktop/core/src/desktop/js/sql/sqlLocationWebWorker.js'],
  31. sqlSyntaxWebWorker: ['./desktop/core/src/desktop/js/sql/sqlSyntaxWebWorker.js']
  32. },
  33. optimization: {
  34. minimize: false,
  35. splitChunks: {
  36. name: splitChunksName
  37. }
  38. },
  39. output: {
  40. path: __dirname + '/desktop/core/src/desktop/static/desktop/js/bundles/workers',
  41. filename: shared.output.filename,
  42. chunkFilename: shared.output.chunkFilename,
  43. globalObject: 'this'
  44. },
  45. module: shared.module,
  46. plugins: getPluginConfig(BUNDLES.WORKERS).concat([
  47. new CleanWebpackPlugin([
  48. `${__dirname}/desktop/core/src/desktop/static/desktop/js/bundles/workers`
  49. ])
  50. ])
  51. };