webpack.config.workers.js 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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/workers/sqlLocationWebWorker.ts'],
  31. sqlSyntaxWebWorker: ['./desktop/core/src/desktop/js/sql/workers/sqlSyntaxWebWorker.ts']
  32. },
  33. optimization: {
  34. minimize: false,
  35. splitChunks: {
  36. name: splitChunksName
  37. }
  38. },
  39. output: {
  40. hashFunction: 'xxhash64',
  41. path: __dirname + '/desktop/core/src/desktop/static/desktop/js/bundles/workers',
  42. filename: shared.output.filename,
  43. chunkFilename: shared.output.chunkFilename,
  44. globalObject: 'this'
  45. },
  46. module: shared.module,
  47. plugins: getPluginConfig(BUNDLES.WORKERS).concat([
  48. new CleanWebpackPlugin({
  49. cleanOnceBeforeBuildPatterns: [
  50. `${__dirname}/desktop/core/src/desktop/static/desktop/js/bundles/workers`
  51. ]
  52. })
  53. ])
  54. };