TypeScript NPM Packages Done Right
blog.liblab.com
TypeScript NPM Packages Done Right
1–10 of 81 posts
Re: TypeScript NPM Packages Done Right
#2I had to recheck this was indeed an article from 2023, because this part surprised me greatly. To my understanding, es2016 only added Array.prototype.includes, the exponentiation operator (**), and preventing generator functions from being constructed. Even the slowest adopters already had these in 2017. Is the author assuming IE11 support?
Re: TypeScript NPM Packages Done Right
#3I have been that vocal minority that keeps complaining about CommonJS support to library authors. But I have given it up for the greater good.
we have a standard now, CommonJS needs to go, why keep pushing non standard stuff in a 2023 article.
Re: TypeScript NPM Packages Done Right
#4I got round this with some funky step where I copy the package.json into the dist folder and rewrite some paths. Is there a better way to do this?
Re: TypeScript NPM Packages Done Right
#5Also, the default target configuration is "es2016," and modern browsers only support up to "es2015." I had to recheck this was indeed an article from 2023, because this part surprised me greatly. To my understanding, es2016 only added Array.prototype.includes, the exponentiation operator (**), and preventing generator functions from being constructed. Even the slowest adopters already had these in 2017. Is the author…
Re: TypeScript NPM Packages Done Right
#6Re: TypeScript NPM Packages Done Right
#7Perhaps I’m missing something, but when I’ve done this in the past, I get weird package resolution because my index.js isn’t in the root (`npm publish` publishes the root and doesn’t support alternate paths to my knowledge) - in the end people have to `import x from “mylib/dist”`. I got round this with some funky step where I copy the package.json into the dist folder and rewrite some paths. Is there a better way to…
Re: TypeScript NPM Packages Done Right
#8I understand the whole CommonJS Vs imports situation. I have been that vocal minority that keeps complaining about CommonJS support to library authors. But I have given it up for the greater good. we have a standard now, CommonJS needs to go, why keep pushing non standard stuff in a 2023 article.
Re: TypeScript NPM Packages Done Right
#9Perhaps I’m missing something, but when I’ve done this in the past, I get weird package resolution because my index.js isn’t in the root (`npm publish` publishes the root and doesn’t support alternate paths to my knowledge) - in the end people have to `import x from “mylib/dist”`. I got round this with some funky step where I copy the package.json into the dist folder and rewrite some paths. Is there a better way to…
Re: TypeScript NPM Packages Done Right
#10So that you can test without doing increments which are not required