To utilize the "keep-names" esbuild option for building in production, you need to pass the "--keep-names" flag when running the esbuild command. This flag instructs esbuild to avoid mangling the names of variables and functions during the minification process.
Here is an example command for building a JavaScript file using esbuild with the "keep-names" option:
esbuild index.js --bundle --minify --keep-names --outfile=dist/bundle.min.js
In this command, "index.js" is the entry file, "--bundle" tells esbuild to bundle all dependencies into a single file, "--minify" instructs esbuild to minify the code, and "--outfile=dist/bundle.min.js" specifies the output file location.
By passing the "--keep-names" flag, esbuild will preserve the original names of variables and functions in the minified output, which can be useful for debugging and maintaining code in production.
Asked: 2023-06-12 22:07:48 +0000
Seen: 13 times
Last updated: Jun 12 '23