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
It would be really useful to be able to load JSON "modules" using loadModule. This is a feature supported by Typescript via the resolveJsonModule compiler option.
The text was updated successfully, but these errors were encountered:
Can't you just load json file with await fetch('./path/to.json').then(rs => rs.json())? Is there any profit in loading it via an import over a fetch()?
The main purpose of this lib is resolving subdependencies. Adding small nice things like json import, while possible, would needlessly overcomplicate it's already not so easy to understand implementation. So unless there is some use case that make json import a must-have feature, I don't think I'll be adding it here.
I believe resolveJsonModule was added as a workaround to support node's require behaviour which was pretty arguable IMHO and was eventually dropped by the node's authors btw.
While it would be more convenient to use the same system for all purposes, you make a good point that there are existing APIs that fill this need. A need that is probably outside the scope of this project. Closing as such.
It would be really useful to be able to load JSON "modules" using
loadModule
. This is a feature supported by Typescript via theresolveJsonModule
compiler option.The text was updated successfully, but these errors were encountered: