vue.config.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. var TerserPlugin = require("terser-webpack-plugin");
  2. // 配置手册: https://cli.vuejs.org/zh/config/#vue-config-js
  3. // electron-bulder配置:https://www.electron.build/configuration/contents#extrafiles
  4. var config = {
  5. // publicPath: './',
  6. devServer: {
  7. port: 8066,
  8. proxy: {
  9. "/api/": {
  10. target: process.env.VUE_APP_DEV_PROXY,
  11. changeOrigin: true
  12. }
  13. }
  14. },
  15. pluginOptions: {
  16. electronBuilder: {
  17. nodeIntegration: true,
  18. externals: [
  19. "cropperjs",
  20. "crypto",
  21. "gm",
  22. "imagemagick",
  23. "deepmerge",
  24. "node-xlsx",
  25. "log4js"
  26. ],
  27. builderOptions: {
  28. extraFiles: [
  29. "extra/checkBlack/**",
  30. "extra/encrypt/**",
  31. "extra/font/**",
  32. "extra/imagemagick/**",
  33. "extra/zxing/**",
  34. "extra/zxingA/**",
  35. "extra/zxingB/**",
  36. "extra/artControl/**",
  37. "extra/database/org.rdb",
  38. "config.sample.json",
  39. "sense_shield_installer_pub_2.2.0.46331.exe",
  40. "vcredist_msvc2017_x86.exe",
  41. "CH341SER.EXE"
  42. ],
  43. win: {
  44. target: [
  45. {
  46. target: "dir", // "dir" 表示 win-unpacked
  47. arch: ["x64"] // 可以指定 "x64", "ia32" 或 "arm64",根据需要选择
  48. }
  49. ],
  50. signAndEditExecutable: false
  51. }
  52. }
  53. }
  54. }
  55. };
  56. // compress配置手册:https://github.com/mishoo/UglifyJS2/tree/harmony#compress-options
  57. if (process.env.NODE_ENV === "production") {
  58. config.configureWebpack = {
  59. plugins: [],
  60. optimization: {
  61. minimizer: [
  62. new TerserPlugin({
  63. terserOptions: { compress: { drop_console: true } }
  64. })
  65. ]
  66. }
  67. };
  68. }
  69. // 解决iview自定义主题导入less报错
  70. config.css = {
  71. loaderOptions: {
  72. less: {
  73. javascriptEnabled: true
  74. }
  75. }
  76. };
  77. module.exports = config;