Use NodeNext
for Typescript
module resolution
#487
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #486
@nene This is an extensive fix to upgrade the codebase to fully embrace ESM (i.e. specifying extensions in exports). This will make
sql-formatter
naturally work with Typescript projects which usemodule = Node16/NodeNext
. Otherwise, we will have to find some other way to tweakpackage.json
to make things work.For example,
uuid
https://github.com/uuidjs/uuid/blob/main/package.json
doesn't use the field
type: module
and fully specifyexports
but I personally think it's just makeshift, we might as well move to adoptESM
fully.I have run
yarn build
andyarn test
locally to make sure things work.One thing you might not like is I don't think we could use alias like
src
anymore so I resolved all imports to use relative paths, sorry about that 🙏