vue.config.js 3.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. const path = require("path");
  2. // const JavaScriptObfuscator = require('webpack-obfuscator');
  3. const isProduction = process.env.NODE_ENV === "production";
  4. module.exports = {
  5. devServer: {
  6. hot: true,
  7. port: 8801,
  8. proxy: {
  9. 'yunweiapi': {
  10. target: 'http://10.1.30.93:8200',
  11. changeOrigin: true,
  12. pathRewrite: {
  13. '^/yunweiapi': ''
  14. }
  15. }
  16. }
  17. },
  18. configureWebpack: { // webpack 配置
  19. devtool: 'source-map',
  20. },
  21. // 公共路径(必须有的)
  22. publicPath: "./",
  23. // 输出文件目录
  24. outputDir: "DS_Menage",
  25. assetsDir: "static",
  26. productionSourceMap: !isProduction,
  27. productionSourceMap: false,
  28. css: {
  29. extract: false
  30. },
  31. runtimeCompiler: true,
  32. pluginOptions: {
  33. // 第三方插件配置
  34. // plugins: [
  35. // new JavaScriptObfuscator(
  36. // {
  37. // compact: true, // 压缩代码
  38. // controlFlowFlattening: true, // 是否启用控制流扁平化(降低1.5倍的运行速度)
  39. // controlFlowFlatteningThreshold: 1, // 应用概率;在较大的代码库中,建议降低此值,因为大量的控制流转换可能会增加代码的大小并降低代码的速度。
  40. // deadCodeInjection: true, // 随机的死代码块(增加了混淆代码的大小)
  41. // deadCodeInjectionThreshold: 1, // 死代码块的影响概率
  42. // debugProtection: true, // 此选项几乎不可能使用开发者工具的控制台选项卡
  43. // debugProtectionInterval: true, // 如果选中,则会在“控制台”选项卡上使用间隔强制调试模式,从而更难使用“开发人员工具”的其他功能。
  44. // disableConsoleOutput: true, // 通过用空函数替换它们来禁用console.log,console.info,console.error和console.warn。这使得调试器的使用更加困难。
  45. // identifierNamesGenerator: "hexadecimal", // 标识符的混淆方式 hexadecimal(十六进制) mangled(短标识符)
  46. // log: false,
  47. // renameGlobals: false, // 是否启用全局变量和函数名称的混淆
  48. // rotateStringArray: true, // 通过固定和随机(在代码混淆时生成)的位置移动数组。这使得将删除的字符串的顺序与其原始位置相匹配变得更加困难。如果原始源代码不小,建议使用此选项,因为辅助函数可以引起注意。
  49. // selfDefending: true, // 混淆后的代码,不能使用代码美化,同时需要配置 cpmpat:true;
  50. // stringArray: true, // 删除字符串文字并将它们放在一个特殊的数组中
  51. // stringArrayEncoding: "rc4",
  52. // stringArrayThreshold: 1,
  53. // transformObjectKeys: true,
  54. // unicodeEscapeSequence: false // 允许启用/禁用字符串转换为unicode转义序列。Unicode转义序列大大增加了代码大小,并且可以轻松地将字符串恢复为原始视图。建议仅对小型源代码启用此选项。
  55. // },
  56. // ["*.js"]
  57. // )
  58. // ]
  59. },
  60. configureWebpack: {
  61. module: {
  62. unknownContextCritical: false,
  63. rules: [
  64. {
  65. test: /\.js$/,
  66. include: path.resolve(__dirname, "node_modules/cesium/Source"),
  67. use: {
  68. loader: "@open-wc/webpack-import-meta-loader"
  69. }
  70. }
  71. ]
  72. }
  73. },
  74. };