# Minimal TypeScript Library

This is a template for a TypeScript library that has the following already properly set up:

- Library can be consumed in NPM
- Library can be consumed in an HTML file (load using \<script> tag)
- A development JS file that has source maps that points back to the TypeScript files for debugging
- A production JS file that is minified / uglified
- Library exposes more than 1 class

This library is an _algorithmic_ library - meaning it's not doing any HTML UI work, just straight algorithmic-like code using JavaScript.

Other things that got accomplished:
- Definition files got generated
- Learned about re-exporting: https://www.typescriptlang.org/docs/handbook/modules.html
 
It has been a rather frustrating learning experience (for me) to get this far. Links that helped to produce this:
- https://marcobotto.com/blog/compiling-and-bundling-typescript-libraries-with-webpack/

  Suggested creating CommonJS build, ES6 build and a UMD build. However, uses old Webpack v2 and the webpack.config.js isn't valid anymore

- https://derekworthen.com/posts/authoring-typescript-libraries/
  
  Suggested also outputting d.ts files. However, the article uses babel which is no longer needed in newer Webpack

- https://webpack.js.org/guides/typescript/
  
  The prior 2 articles' webpack.config.js didn't quite work, so I ended up using the config on webpack's website. Source map config is also from this article

- https://webpack.js.org/guides/production/
  
  This article suggests using different config files

- https://stackoverflow.com/questions/64639839/typescript-webpack-library-generates-referenceerror-self-is-not-defined
  
  Prior configs result in library not usable in NPM environment
  
