fix: Make explicit imports of index.js
in main library files.
#5668
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 #4991 by making imports of subpackages reference the
index.js
file explicitly.The newer
"nodenext"
resolution rules require relative imports to include the file extension, and implicit index imports are not supported. Under these rules, exports likeexport * from './core';
fail. This change works around these rules by changing these imports toexport * from './core/index.js';
which resolves correctly under both"nodenext"
and the default"node"
resolution rules. It seems sufficient to only update the imports in the mainindex.ts
files, TypeScript appears to use the default rules with deeper imports.This is likely the less hacky solution, but this might break people's bundlers if they don't handle imports that include extensions.