Skip to content

Isolating parts of the library using Terser #73

Answered by 101arrowz
belohlavek asked this question in Q&A
Discussion options

You must be logged in to vote

To generate custom builds myself, I usually run the build through terser. You can just paste the CJS build into a text editor, then find+replace all the exports with nothing (e.g. with the regex exports.*;$ and manually removing exports.FlateErrorCode). Now, manually write the exports you want at the bottom (e.g. exports.unzipSync = unzipSync;), then plug it through terser (since I'm lazy I use terser-online). Now you have a minified file that contains the exports, and you can use the TypeScript declaration file provided with fflate to plug it through TypescriptToLua.

Unrelated, but I'm curious why you don't just use bindings to native Zlib written in Lua. They would probably be faster than

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@belohlavek
Comment options

@101arrowz
Comment options

Answer selected by 101arrowz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants