-
Notifications
You must be signed in to change notification settings - Fork 674
Temporarily add "node" entries to exports in package.json files #5650
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
iclanton
merged 8 commits into
microsoft:main
from
iclanton:remove-package.json-exports-imports
Feb 20, 2026
+1,045
−71
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
47b8e5f
fix: remove "import" entries from exports in package.json files
iclanton 3c64ab8
Revert "fix: remove "import" entries from exports in package.json files"
iclanton 83978b4
fix: add "node" condition to exports to fix ESM resolution (#5644)
iclanton 7218295
fix: add "node" condition to exports to fix ESM resolution (#5644)
iclanton c17ffc7
fixup! fix: add "node" condition to exports to fix ESM resolution (#5…
iclanton 7f65e98
Rush update.
iclanton 7e90777
fixup! fix: add "node" condition to exports to fix ESM resolution (#5…
iclanton ee6096e
fixup! fix: add "node" condition to exports to fix ESM resolution (#5…
iclanton File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,3 @@ | ||
| { | ||
| "extends": "local-node-rig/profiles/default/config/jest.config.json" | ||
| } |
This file contains hidden or 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,7 @@ | ||
| { | ||
| // The "rig.json" file directs tools to look for their config files in an external package. | ||
| // Documentation for this system: https://www.npmjs.com/package/@rushstack/rig-package | ||
| "$schema": "https://developer.microsoft.com/json-schemas/rig-package/rig.schema.json", | ||
|
|
||
| "rigPackageName": "local-node-rig" | ||
| } |
This file contains hidden or 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,20 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
| // See LICENSE in the project root for license information. | ||
|
|
||
| const nodeProfile = require('local-node-rig/profiles/default/includes/eslint/flat/profile/node'); | ||
| const friendlyLocalsMixin = require('local-node-rig/profiles/default/includes/eslint/flat/mixins/friendly-locals'); | ||
| const tsdocMixin = require('local-node-rig/profiles/default/includes/eslint/flat/mixins/tsdoc'); | ||
|
|
||
| module.exports = [ | ||
| ...nodeProfile, | ||
| ...friendlyLocalsMixin, | ||
| ...tsdocMixin, | ||
| { | ||
| files: ['**/*.ts', '**/*.tsx'], | ||
| languageOptions: { | ||
| parserOptions: { | ||
| tsconfigRootDir: __dirname | ||
| } | ||
| } | ||
| } | ||
| ]; |
This file contains hidden or 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,20 @@ | ||
| { | ||
| "name": "esm-node-import-test", | ||
| "description": "This project validates that importing a rushstack package from a 'type: module' Node.js project works correctly with the package.json 'exports' field. See https://github.com/microsoft/rushstack/issues/5644", | ||
| "version": "1.0.0", | ||
| "private": true, | ||
| "type": "module", | ||
| "scripts": { | ||
| "build": "heft test --clean", | ||
| "_phase:build": "heft run --only build -- --clean", | ||
| "_phase:test": "heft run --only test -- --clean" | ||
| }, | ||
| "dependencies": { | ||
| "@rushstack/node-core-library": "workspace:*" | ||
| }, | ||
| "devDependencies": { | ||
| "@rushstack/heft": "workspace:*", | ||
| "eslint": "~9.37.0", | ||
| "local-node-rig": "workspace:*" | ||
| } | ||
| } |
This file contains hidden or 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,16 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
| // See LICENSE in the project root for license information. | ||
|
|
||
| import { Path } from '@rushstack/node-core-library'; | ||
|
|
||
| export const EXPECTED_OUTPUT: string = | ||
| 'ESM import test PASSED: @rushstack/node-core-library resolved correctly under Node.js ESM.'; | ||
|
|
||
| // If this line runs without ERR_MODULE_NOT_FOUND, the exports map is working correctly. | ||
| const result: string = Path.convertToSlashes('foo\\bar'); | ||
| if (result !== 'foo/bar') { | ||
| throw new Error('Unexpected result from Path.convertToSlashes: ' + result); | ||
| } | ||
|
|
||
| // eslint-disable-next-line no-console | ||
| console.log(EXPECTED_OUTPUT); | ||
6 changes: 6 additions & 0 deletions
6
build-tests/esm-node-import-test/src/test/__snapshots__/start.test.ts.snap
This file contains hidden or 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,6 @@ | ||
| // Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
|
||
| exports[`ESM Node Import Test should resolve @rushstack/node-core-library correctly under Node.js ESM 1`] = ` | ||
| "ESM import test PASSED: @rushstack/node-core-library resolved correctly under Node.js ESM. | ||
| " | ||
| `; |
This file contains hidden or 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,28 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT license. | ||
| // See LICENSE in the project root for license information. | ||
|
|
||
| import type { ChildProcess } from 'node:child_process'; | ||
|
|
||
| import { Executable, PackageJsonLookup } from '@rushstack/node-core-library'; | ||
|
|
||
| describe('ESM Node Import Test', () => { | ||
| it('should resolve @rushstack/node-core-library correctly under Node.js ESM', async () => { | ||
| const buildFolderPath: string | undefined = PackageJsonLookup.instance.tryGetPackageFolderFor(__dirname); | ||
| if (!buildFolderPath) { | ||
| throw new Error('Unable to determine build folder path for test script.'); | ||
| } | ||
|
|
||
| const result: ChildProcess = Executable.spawn(process.execPath, [`${buildFolderPath}/lib-esm/start.js`], { | ||
| currentWorkingDirectory: buildFolderPath | ||
| }); | ||
|
|
||
| const { stderr, stdout, exitCode, signal } = await Executable.waitForExitAsync(result, { | ||
| encoding: 'utf8' | ||
| }); | ||
|
|
||
| expect(stderr).toBe(''); | ||
| expect(stdout).toMatchSnapshot(); | ||
| expect(exitCode).toBe(0); | ||
| expect(signal).toBeNull(); | ||
| }); | ||
| }); |
This file contains hidden or 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,3 @@ | ||
| { | ||
| "extends": "./node_modules/local-node-rig/profiles/default/tsconfig-base.json" | ||
| } |
11 changes: 11 additions & 0 deletions
11
...anges/@microsoft/api-documenter/remove-package.json-exports-imports_2026-02-19-22-16.json
This file contains hidden or 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,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "comment": "Add `\"node\"` condition before `\"import\"` in the `\"exports\"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `\"import\"`. Fixes https://github.com/microsoft/rushstack/issues/5644.", | ||
| "type": "patch", | ||
| "packageName": "@microsoft/api-documenter" | ||
| } | ||
| ], | ||
| "packageName": "@microsoft/api-documenter", | ||
| "email": "iclanton@users.noreply.github.com" | ||
| } |
11 changes: 11 additions & 0 deletions
11
.../@microsoft/api-extractor-model/remove-package.json-exports-imports_2026-02-19-22-16.json
This file contains hidden or 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,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "comment": "Add `\"node\"` condition before `\"import\"` in the `\"exports\"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `\"import\"`. Fixes https://github.com/microsoft/rushstack/issues/5644.", | ||
| "type": "patch", | ||
| "packageName": "@microsoft/api-extractor-model" | ||
| } | ||
| ], | ||
| "packageName": "@microsoft/api-extractor-model", | ||
| "email": "iclanton@users.noreply.github.com" | ||
| } |
11 changes: 11 additions & 0 deletions
11
...hanges/@microsoft/api-extractor/remove-package.json-exports-imports_2026-02-19-22-16.json
This file contains hidden or 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,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "comment": "Add `\"node\"` condition before `\"import\"` in the `\"exports\"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `\"import\"`. Fixes https://github.com/microsoft/rushstack/issues/5644.", | ||
| "type": "patch", | ||
| "packageName": "@microsoft/api-extractor" | ||
| } | ||
| ], | ||
| "packageName": "@microsoft/api-extractor", | ||
| "email": "iclanton@users.noreply.github.com" | ||
| } |
11 changes: 11 additions & 0 deletions
11
...s/@microsoft/load-themed-styles/remove-package.json-exports-imports_2026-02-19-22-16.json
This file contains hidden or 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,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "comment": "Add `\"node\"` condition before `\"import\"` in the `\"exports\"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `\"import\"`. Fixes https://github.com/microsoft/rushstack/issues/5644.", | ||
| "type": "patch", | ||
| "packageName": "@microsoft/load-themed-styles" | ||
| } | ||
| ], | ||
| "packageName": "@microsoft/load-themed-styles", | ||
| "email": "iclanton@users.noreply.github.com" | ||
| } |
11 changes: 11 additions & 0 deletions
11
...osoft/loader-load-themed-styles/remove-package.json-exports-imports_2026-02-19-22-16.json
This file contains hidden or 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,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "comment": "Add `\"node\"` condition before `\"import\"` in the `\"exports\"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `\"import\"`. Fixes https://github.com/microsoft/rushstack/issues/5644.", | ||
| "type": "patch", | ||
| "packageName": "@microsoft/loader-load-themed-styles" | ||
| } | ||
| ], | ||
| "packageName": "@microsoft/loader-load-themed-styles", | ||
| "email": "iclanton@users.noreply.github.com" | ||
| } |
11 changes: 11 additions & 0 deletions
11
common/changes/@microsoft/rush/remove-package.json-exports-imports_2026-02-19-22-16.json
This file contains hidden or 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,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "comment": "Add `\"node\"` condition before `\"import\"` in the `\"exports\"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `\"import\"`. Fixes https://github.com/microsoft/rushstack/issues/5644.", | ||
| "type": "none", | ||
| "packageName": "@microsoft/rush" | ||
| } | ||
| ], | ||
| "packageName": "@microsoft/rush", | ||
| "email": "iclanton@users.noreply.github.com" | ||
| } |
11 changes: 11 additions & 0 deletions
11
...pack5-load-themed-styles-loader/remove-package.json-exports-imports_2026-02-19-22-16.json
This file contains hidden or 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,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "comment": "Add `\"node\"` condition before `\"import\"` in the `\"exports\"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `\"import\"`. Fixes https://github.com/microsoft/rushstack/issues/5644.", | ||
| "type": "patch", | ||
| "packageName": "@microsoft/webpack5-load-themed-styles-loader" | ||
| } | ||
| ], | ||
| "packageName": "@microsoft/webpack5-load-themed-styles-loader", | ||
| "email": "iclanton@users.noreply.github.com" | ||
| } |
11 changes: 11 additions & 0 deletions
11
...ushstack/cpu-profile-summarizer/remove-package.json-exports-imports_2026-02-19-22-16.json
This file contains hidden or 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,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "comment": "Add `\"node\"` condition before `\"import\"` in the `\"exports\"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `\"import\"`. Fixes https://github.com/microsoft/rushstack/issues/5644.", | ||
| "type": "patch", | ||
| "packageName": "@rushstack/cpu-profile-summarizer" | ||
| } | ||
| ], | ||
| "packageName": "@rushstack/cpu-profile-summarizer", | ||
| "email": "iclanton@users.noreply.github.com" | ||
| } |
11 changes: 11 additions & 0 deletions
11
...ges/@rushstack/credential-cache/remove-package.json-exports-imports_2026-02-19-22-16.json
This file contains hidden or 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,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "comment": "Add `\"node\"` condition before `\"import\"` in the `\"exports\"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `\"import\"`. Fixes https://github.com/microsoft/rushstack/issues/5644.", | ||
| "type": "patch", | ||
| "packageName": "@rushstack/credential-cache" | ||
| } | ||
| ], | ||
| "packageName": "@rushstack/credential-cache", | ||
| "email": "iclanton@users.noreply.github.com" | ||
| } |
11 changes: 11 additions & 0 deletions
11
...stack/debug-certificate-manager/remove-package.json-exports-imports_2026-02-19-22-16.json
This file contains hidden or 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,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "comment": "Add `\"node\"` condition before `\"import\"` in the `\"exports\"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `\"import\"`. Fixes https://github.com/microsoft/rushstack/issues/5644.", | ||
| "type": "patch", | ||
| "packageName": "@rushstack/debug-certificate-manager" | ||
| } | ||
| ], | ||
| "packageName": "@rushstack/debug-certificate-manager", | ||
| "email": "iclanton@users.noreply.github.com" | ||
| } |
11 changes: 11 additions & 0 deletions
11
.../changes/@rushstack/eslint-bulk/remove-package.json-exports-imports_2026-02-19-22-16.json
This file contains hidden or 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,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "comment": "Add `\"node\"` condition before `\"import\"` in the `\"exports\"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `\"import\"`. Fixes https://github.com/microsoft/rushstack/issues/5644.", | ||
| "type": "patch", | ||
| "packageName": "@rushstack/eslint-bulk" | ||
| } | ||
| ], | ||
| "packageName": "@rushstack/eslint-bulk", | ||
| "email": "iclanton@users.noreply.github.com" | ||
| } |
11 changes: 11 additions & 0 deletions
11
...changes/@rushstack/eslint-patch/remove-package.json-exports-imports_2026-02-19-22-16.json
This file contains hidden or 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,11 @@ | ||
| { | ||
| "changes": [ | ||
| { | ||
| "comment": "Add `\"node\"` condition before `\"import\"` in the `\"exports\"` map so that Node.js uses the CJS output (which handles extensionless imports), while bundlers still use ESM via `\"import\"`. Fixes https://github.com/microsoft/rushstack/issues/5644.", | ||
| "type": "patch", | ||
| "packageName": "@rushstack/eslint-patch" | ||
| } | ||
| ], | ||
| "packageName": "@rushstack/eslint-patch", | ||
| "email": "iclanton@users.noreply.github.com" | ||
| } |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.