Package Exports
- @juststarting00/minimal-ts-library
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (@juststarting00/minimal-ts-library) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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
-
Prior configs result in library not usable in NPM environment