0

I am the author of TreeJS. So far, I use TypeScript to generate the build file (plain browser-understandable JS), a Type Definitions file, and a map file for the unminified build. I use an external tool called Minify to minify the build.

My question is, should I also create a map file for the minified build, or the map file for the unminified build will work with the minfied one?

And, If I do need to build a map for that, does anyone know any tools?

RealZombs
  • 135
  • 1
  • 12

1 Answers1

1

Since it is your library, you don't need to do anything you don't want, but source maps can be huge help for your users. Minify uses terser to minify JavaScript, and terser can generate composed source maps. I never worked with Minify, but it seems like you can pass map generated by typescript in options.

Mr. Hedgehog
  • 2,644
  • 1
  • 14
  • 18
  • so is it better if I use **just** terser instead of Minify? BTW, thanks! I just googled up [this](https://stackoverflow.com/a/21719713/14925444), and and by the looks I found out that source maps are used to **trace out the original .ts file (in my case)**. Thanks for your answer, otherwise I would have been stuck at the thought that maps are used to map out the **transpiled** files... – RealZombs Mar 10 '21 at 02:37
  • You can continue to use Minify, or use terser standalone, or not minify at all, if this is a library. Library will be minified anyway in target app via webpack or other bundler – Mr. Hedgehog Mar 10 '21 at 07:32
  • Oh. But, I also want to target the non-bundling users; the ones who just want to load in the library into their HTML and do some stuff, so I thought to minify it. I think I'll switch to Terser indeed. Thanks! – RealZombs Mar 10 '21 at 09:27
  • 1
    Yes. For direct usage you need to minify and and source maps. – Mr. Hedgehog Mar 10 '21 at 09:29