vue.config.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. var TerserPlugin = require("terser-webpack-plugin");
  2. var devProxy = {};
  3. try {
  4. devProxy = require("./dev-proxy");
  5. } catch (error) {}
  6. var proxy = process.env.NODE_ENV === "production" ? {} : devProxy;
  7. // 配置手册: https://cli.vuejs.org/zh/config/#vue-config-js
  8. // electron-bulder配置:https://www.electron.build/configuration/contents#extrafiles
  9. var config = {
  10. // publicPath: './',
  11. devServer: {
  12. port: 8066
  13. },
  14. pluginOptions: {
  15. electronBuilder: {
  16. builderOptions: {
  17. extraFiles: [
  18. "extra/encrypt/**",
  19. "extra/font/**",
  20. "extra/imagemagick/**",
  21. "extra/zxing/**",
  22. "extra/zxingA/**",
  23. "extra/artControl/**",
  24. "extra/database/org.rdb",
  25. "config.sample.json",
  26. "sense_shield_installer_pub_2.2.0.46331.exe"
  27. ],
  28. win: {
  29. target: "portable",
  30. signAndEditExecutable: false
  31. }
  32. }
  33. }
  34. }
  35. };
  36. // compress配置手册:https://github.com/mishoo/UglifyJS2/tree/harmony#compress-options
  37. if (process.env.NODE_ENV === "production") {
  38. config.configureWebpack = {
  39. plugins: [],
  40. optimization: {
  41. minimizer: [
  42. new TerserPlugin({
  43. terserOptions: { compress: { drop_console: true } }
  44. })
  45. ]
  46. }
  47. };
  48. }
  49. if (proxy && Object.keys(proxy).length) {
  50. config.devServer.proxy = proxy;
  51. }
  52. // 解决iview自定义主题导入less报错
  53. config.css = {
  54. loaderOptions: {
  55. less: {
  56. javascriptEnabled: true
  57. }
  58. }
  59. };
  60. module.exports = config;