// 1. ASI: this returns undefined, not the object
function pick() {
return // <- semicolon auto-inserted here
{ ok: true };
}
// 2. line joining creates a call that never existed
const total = fn
(a || b).forEach(log) // joined: fn(a || b).forEach(log)
// 3. slash ambiguity — is it division or a regex?
const x = a / b / c; // two divisions
const ok = /a\/b/.test(s); // one regex containing a slash
// a byte-level replacer cannot tell these apart
// last line of bundle.min.js
//# sourceMappingURL=bundle.min.js.map
// hidden-maps workflow (Sentry example)
esbuild app.ts --minify --sourcemap=external --outfile=dist/app.js
sentry-cli sourcemaps upload --release=v1.4.2 ./dist
rm dist/*.map # maps never reach the CDN
// stack trace before / after symbolication
at t (bundle.min.js:1:48213)
at checkout (src/cart/checkout.ts:87:11) // with map + matching release
Click Minify — the output appears on the right with the size saving in bytes and percent.
Copy the minified result to embed in a <style> or <script> tag.
Use the original source as the long-term editable copy and only ship the minified version.
主な使用例
Inlining critical CSS in the <head> for faster First Contentful Paint.
Shrinking a Google Tag Manager custom HTML snippet to the size limit.
Compacting a JS one-liner you want to embed in a bookmarklet.
Reducing the size of email-safe CSS where every byte matters.
Trimming a no-bundler vanilla JS file before deploying to a static host.
Estimating the bundle-size impact of a snippet before adding it to a build.
よくある質問
Q. Is this safe for production JavaScript?
A. For trivial scripts yes. For real applications use a battle-tested minifier like esbuild, terser, or swc inside your build pipeline so source maps and ECMAScript edge cases are handled.
Q. Why does the output break my CSS?
A. Most often a missing semicolon in the source. CSS minification assumes valid input — fix the source, then minify.
Q. Does minifying obfuscate my code?
A. Slightly — names are not changed, only whitespace is stripped. For real obfuscation use a dedicated tool, but understand it does not provide real security.
Q. Can I minify HTML the same way?
A. HTML minification needs different rules (preserved whitespace in <pre>, attribute quoting, etc.). Use a dedicated HTML minifier for that.