我正在嘗試使用 grunt 和 terser 縮小 angularjs 應(yīng)用程序。我首先使用 uglifiy-es 但后來讀到它有一些問題。所以我嘗試了更簡潔。但是輸出沒有給我縮小的文件。gruntfile.js module.exports = function(grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), //grunt task configuration will go here ngAnnotate: { options: { singleQuotes: true }, app: { files: { './public/min-safe/js/_config_min.js': ['./controllers/_config.js'], './public/min-safe/js/ctrl_accountingdashboard.js': ['./controllers/ctrl_accountingdashboard.js'], } } }, concat: { js: { //target src: ['./public/min/app.js', './public/min-safe/js/*.js'], dest: './public/min/app.js' } }, terser: { options: {}, files: { './public/min/app.js': ['./public/min/app.js'], }, } }); //load grunt tasks grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-terser'); grunt.loadNpmTasks('grunt-ng-annotate'); //register grunt default task grunt.registerTask('default', ['ngAnnotate', 'concat', 'terser']);}
Terser 不提供縮小的文件
慕桂英3389331
2021-06-10 18:20:59