Ask Your Question
0

How do I utilize the "keep-names" esbuild option for building in production?

asked 2023-06-12 22:07:48 +0000

david gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2023-06-12 22:18:02 +0000

qstack gravatar image

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.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-06-12 22:07:48 +0000

Seen: 13 times

Last updated: Jun 12 '23