-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(esm): Add exports within package.json to enable scoped package l…
…oading. (#6192) * feat(esm): Add exports within package.json to enable scoped package loading. In order for module resolution to work with .mjs or package: module code we need to utilize the conditional export feature of node. > The current specifier resolution does not support all default behavior of the CommonJS loader. One of the behavior differences is automatic resolution of file extensions and the ability to import directories that have an index file. https://nodejs.org/api/esm.html#esm_customizing_esm_specifier_resolution_algorithm https://nodejs.org/api/packages.html#packages_conditional_exports This directly enables rxjs to work with mjs code and commonjs code since mjs does not support loading bare folder paths. This is a fix to: sveltejs/kit#612 and is directly related to the conversation in this issue within node core nodejs/node#27408 * feat(esm): Add test case for esm imports. Context: sveltejs/kit#612 nodejs/node#27408
- Loading branch information
Showing
3 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
/* Test file to ensure rxjs can be loaded from esm | ||
https://github.com/ReactiveX/rxjs/pull/6192 | ||
If this fails node will error when running this with an error like | ||
node:internal/process/esm_loader:74 | ||
internalBinding('errors').triggerUncaughtException( | ||
*/ | ||
import {Observable} from 'rxjs'; | ||
import * as o from 'rxjs/operators'; | ||
import * as a from 'rxjs/ajax'; | ||
import * as f from 'rxjs/fetch'; | ||
import * as t from 'rxjs/testing'; | ||
import * as w from 'rxjs/webSocket'; |