您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

webpack.mapv.conf.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  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.mapv': ['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/mapv/dist'),
  33. publicPath: publicPath,
  34. library: 'DcMapv',
  35. libraryTarget: 'umd',
  36. umdNamedDefine: true
  37. },
  38. module: {
  39. unknownContextCritical: false,
  40. rules: [
  41. {
  42. test: /\.js$/,
  43. exclude: /node_modules/,
  44. loader: 'babel-loader',
  45. options: {
  46. presets: ['@babel/preset-env'],
  47. compact: false,
  48. ignore: ['checkTree']
  49. }
  50. }
  51. ]
  52. },
  53. resolve: {
  54. extensions: ['.js', '.json', '.css'],
  55. alias: {
  56. '@dc-modules': path.resolve(__dirname, '..', 'modules'),
  57. 'mapv-lib': path.resolve(__dirname, '..', 'libs/mapv.min.js'),
  58. entry: path.resolve(__dirname, '..', 'packages/mapv/index.js')
  59. }
  60. },
  61. plugins
  62. }
  63. }