Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

webpack.chart.conf.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /**
  2. * @Author: Caven
  3. * @Date: 2021-03-14 00:41:29
  4. */
  5. 'use strict'
  6. const path = require('path')
  7. const webpack = require('webpack')
  8. const JavaScriptObfuscator = require('webpack-obfuscator')
  9. const common = require('./common')
  10. module.exports = env => {
  11. const IS_PROD = (env && env.production) || false
  12. const publicPath = IS_PROD ? '/' : '/'
  13. let plugins = [...common.plugins]
  14. if (IS_PROD) {
  15. plugins.push(new webpack.NoEmitOnErrorsPlugin())
  16. plugins.push(
  17. new JavaScriptObfuscator(
  18. {
  19. rotateStringArray: true
  20. },
  21. []
  22. )
  23. )
  24. }
  25. return {
  26. entry: {
  27. 'dc.chart': ['entry']
  28. },
  29. devtool: IS_PROD ? false : 'cheap-module-eval-source-map',
  30. output: {
  31. filename: IS_PROD ? '[name].min.js' : '[name].js',
  32. path: path.resolve(__dirname, '..', 'packages/chart/dist'),
  33. publicPath: publicPath,
  34. library: 'DcChart',
  35. libraryTarget: 'umd',
  36. umdNamedDefine: true
  37. },
  38. module: {
  39. unknownContextCritical: false,
  40. rules: common.rules
  41. },
  42. resolve: {
  43. extensions: ['.js', '.json', '.css'],
  44. alias: {
  45. '@dc-modules': path.resolve(__dirname, '..', 'modules'),
  46. entry: path.resolve(__dirname, '..', 'packages/chart/index.js')
  47. }
  48. },
  49. plugins
  50. }
  51. }