Use module/moduleResolution of 'nodenext' #92
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.
@metamask/utils
ships with Node-specific functions, but in order to use them you have to import them a special way. Instead of sayingyou have to say
However, this syntax only works if TypeScript is configured to use a
module
andmoduleResolution
option ofnodenext
(ornode16
), because then TypeScript will consult theexports
field of@metamask/utils
to know how to resolve@metamask/utils/node
(which it does not do with the current value for this option).module-lint
wasn't using this TypeScript configuration option; it used a hack to manually resolve@metamask/utils/node
to the right place. This hack will no longer work in newer versions of@metamask/utils
, and in order to make this work we now have to use the aforementioned TypeScript configuration option.At the same time, the
superstruct
package will not compile when using this configuration option, so to fix this, we also switch to our fork ofsuperstruct
, which does work.