javascriptangulartypescriptng-packagr

Does ng-packagr generate script who can run in the browser like normal js?


Can I use ng-packagr to build library with one script file that can run on the browser in the html by import as <script src="bundle.js"></script>?

For example I have main.ts that do console.log('hello'); and I want to create index.html and import this code: <script src="main.js"></script>.

Is it possible to do that with ng-packagr? because I can see that I generate files: esm2020,fesm2015, fesm2020 and those types are not compatibility with all browsers

And I don't care if the script is wrapped by webpack


Solution

  • No, ng-packagr is meant to be used to build angular libraries, not standalone libraries.