参照:https://www.npmjs.com/package/cordova-uglify

安装:npm install cordova-uglify

安装完成之后,打开:

hooks/uglify-config.json

{
    "alwaysRun": true,
    "recursiveFolderSearch": true,
    "foldersToProcess": [
        "js",
        "css",
    ],
    "uglifyJsOptions": {
        "compress": {
            "drop_console": true
        },
        "fromString": true
    },
    "cleanCssOptions": {
        "noAdvanced": true,
        "keepSpecialComments": 0
    }
}

修改:alwaysRun": true,

运行:cordova build android

解压apk可以看一下js与css文件已经被压缩处理了.

相关文章:

  • 2021-07-17
  • 2022-12-23
  • 2021-05-05
  • 2022-12-23
  • 2021-05-23
  • 2022-02-13
  • 2022-12-23
猜你喜欢
  • 2021-05-03
  • 2021-05-25
  • 2021-05-31
  • 2022-12-23
  • 2022-12-23
  • 2022-02-02
  • 2021-08-17
相关资源
相似解决方案