Skip to content
| Marketplace
Sign in
Visual Studio Code>Other>minifyJSNew to Visual Studio Code? Get it now.
minifyJS

minifyJS

Morley Digital UK

|
57 installs
| (0) | Free
Minify JavaScript files using the terser minification library. Minify the active file with a command or automatically on save, with optional source map generation.
Installation
Launch VS Code Quick Open (Ctrl+P), paste the following command, and press enter.
Copied to clipboard
More Info

minifyJS

Minify JavaScript files in VS Code using terser — the same minifier used under the hood by webpack, Rollup, and Vite.

Minify the active file with a command, or enable automatic minification on save. Output is written to a .min.js file alongside the source, with optional source map generation.

Features

  • One-command minification of the active JavaScript file.
  • Minify on save — automatically, for all files or only those that already have a .min.js.
  • Compression & mangling — dead-code elimination, constant folding, and identifier shortening via terser.
  • Source maps — optionally emit a .min.js.map and a sourceMappingURL comment.
  • Built on actively maintained, modern tooling (terser).

Usage

  • Command palette → Minify Current JavaScript File — minifies the currently open JavaScript file immediately.
  • On save — set minifyjs.minifyOnSave to minify automatically whenever a JavaScript file is saved.

Output is written to <filename>.min.js in the same directory. .min.js files are never re-processed.

Settings

Setting Default Description
minifyjs.minifyOnSave "No" "No" — disabled; "Existing" — only if a .min.js already exists; "All" — always
minifyjs.generateSourceMap false Write a .min.js.map file and a sourceMappingURL comment
minifyjs.successNotificationStatusBar false Show a status bar message on success
minifyjs.successNotificationInformationMessage false Show an info popup on success

Known issues

  • Default parameters that reference a shadowed outer variable are minified incorrectly by terser (both compress and mangle). If a parameter's default value reads an outer variable, and the function body redeclares a var with the same name, terser treats the default as referring to the inner variable:

    var outer = 5;
    function g(x = outer) { var outer = 1; return x; }
    g(); // 5 in the source; throws ReferenceError (or returns the wrong value) once minified
    

    This is an upstream terser bug (terser 5.51.0 fixed it, but 5.51.2 rolled the fix back). Workaround: rename the inner variable so it doesn't shadow the one used in the default value.

Source & issues

Source code, contributing guidelines, and issue tracker are on GitHub.

  • Contact us
  • Jobs
  • Privacy
  • Manage cookies
  • Terms of use
  • Trademarks
  • Your Privacy Choices
  • Consumer Health Privacy
© 2026 Microsoft