webpack.config.npm.js 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * Licensed to Cloudera, Inc. under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. Cloudera, Inc. licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. const { VueLoaderPlugin } = require('vue-loader');
  19. const CleanWebpackPlugin = require('clean-webpack-plugin');
  20. const CopyWebpackPlugin = require('copy-webpack-plugin');
  21. const webpackConfig = require('./webpack.config');
  22. const distDir = `${__dirname}/npm_dist`;
  23. module.exports = Object.assign({}, webpackConfig, {
  24. entry: {
  25. 'er-diagram': ['./desktop/core/src/desktop/js/components/er-diagram/webcomp.ts']
  26. },
  27. mode: 'production',
  28. optimization: {
  29. minimize: true
  30. },
  31. output: {
  32. path: `${distDir}/web`
  33. },
  34. plugins: [
  35. new CleanWebpackPlugin([distDir]),
  36. new VueLoaderPlugin(),
  37. new CopyWebpackPlugin({
  38. patterns: [
  39. {from:'./package.json', to: `${distDir}/`},
  40. {from:'./NPM-README.md', to: `${distDir}/README.md`},
  41. {from:'./desktop/core/src/desktop/js/components', to: `${distDir}/components`},
  42. {from:'./desktop/core/src/desktop/js/utils/hueUtils.js', to: `${distDir}/utils/hueUtils.js`},
  43. {from:'./desktop/core/src/desktop/js/parse', to: `${distDir}/js/parse`},
  44. {from:'./desktop/core/src/desktop/js/sql', to: `${distDir}/js/sql`},
  45. ]
  46. })
  47. ]
  48. });