You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I spent a long time yesterday trying to understand what tsconfig settings one should use for creating a typescript package intended for use on the web. I believe, based on the documentation, Node16 is still the best option since it mostly will work with bundlers.
It would be a nice addition to this repo to have a little more clarity for those creating packages specifically for the web. This could be simply adding text above which config fits this need the best.
Also - Node16 changes how imports need to resolve with extensions which i know is not the most common practice in modern web development, although it seems to be the written standard ( may be wrong on that).
So i guess my issue is, can we either add text to the proper config and note this is best for web based packages as well - or create a base that highlights a config that a web based package can use and publish to npm, to create a modern typescript package intended to be consumed by others.
Thanks!
The text was updated successfully, but these errors were encountered:
We target runtimes with the bases, and you could very reasonably argue that the web is a runtime but I think doing so would be misleading on our part.
If you're writing code using a bundler, your runtime is that bundler (which is why we have vite support in here for example) but if you're using typescript to change some .ts files to .js files as a <script> then what you really want is a "lowest target browser runtime" tsconfig base and I don't want to commit to recreating something like @babel/preset-env in this repo to do it accurately
So if i understand the above, really there is no moduleResolution setting needed for a browser based target, its really just setting target to whatever browser your trying to hit?
Hi,
I spent a long time yesterday trying to understand what tsconfig settings one should use for creating a typescript package intended for use on the web. I believe, based on the documentation, Node16 is still the best option since it mostly will work with bundlers.
It would be a nice addition to this repo to have a little more clarity for those creating packages specifically for the web. This could be simply adding text above which config fits this need the best.
Also - Node16 changes how imports need to resolve with extensions which i know is not the most common practice in modern web development, although it seems to be the written standard ( may be wrong on that).
So i guess my issue is, can we either add text to the proper config and note this is best for web based packages as well - or create a base that highlights a config that a web based package can use and publish to npm, to create a modern typescript package intended to be consumed by others.
Thanks!
The text was updated successfully, but these errors were encountered: