Magento 2 has native feature to JS Minify from the Configuration Setting admin panel.
To Minify JavaScript files in Magento 2 Via admin panel,
Go To Admin panel,
Click Stores -> Settings -> Configuration from the left sidebar.
Select Developer Tab under the Advanced from the left sidebar,
Open the JavaScript Settings section,
Minify Javascript file to Yes,
Click on Save Config. Continue reading “Check JS minify or not programmatically in Magento 2.”