-
Notifications
You must be signed in to change notification settings - Fork 536
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
build(client-utils): use export map instead of 'browser' field #20665
Conversation
"require": { | ||
"types": "./dist/bufferBrowser.d.ts", | ||
"default": "./dist/bufferBrowser.js" | ||
} | ||
} | ||
} | ||
}, | ||
"main": "lib/indexNode.js", | ||
"browser": { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we delete this altogether?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CloudPack doesn't use it. If it passes our Jest tests, I think we're good to go.
@@ -3,7 +3,8 @@ | |||
* Licensed under the MIT License. | |||
*/ | |||
|
|||
import { IsoBuffer } from "./indexNode.js"; | |||
// Note: The exports map in package.json will correct this import to "./bufferNode.js" in node environments | |||
import { IsoBuffer } from "./bufferBrowser.js"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: changed to 'bufferBrowser.js' instead of 'indexBrowser.js' to avoid import cycle.
"browser": { | ||
"./dist/indexNode.js": "./dist/indexBrowser.js", | ||
"./dist/indexNode.d.ts": "./dist/indexBrowser.d.ts", | ||
"./lib/indexNode.js": "./lib/indexBrowser.js", | ||
"./lib/indexNode.d.ts": "./lib/indexBrowser.d.ts" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removing these means any uses of indexNode.js will not be redirected to indexBrowser.js. trace.ts uses indexNode.js; so, that needs corrected.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related issue: #21252
"browser": { | ||
"./dist/indexNode.js": "./dist/indexBrowser.js", | ||
"./dist/indexNode.d.ts": "./dist/indexBrowser.d.ts", | ||
"./lib/indexNode.js": "./lib/indexBrowser.js", | ||
"./lib/indexNode.d.ts": "./lib/indexBrowser.d.ts" | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is also replicated in src/cjs/package.json that is needed for webpack (with CJS). AB#7374 would help avoid getting out of sync.
…soft#20665) Previously, we used [the 'browser' field](https://github.com/defunctzombie/package-browser-field-spec) to implement different entry points for browser vs. node. This field does not appear to be supported by CloudPack. Instead, we now use [conditional exports](https://nodejs.org/docs/latest-v18.x/api/packages.html#conditional-exports) in the export map.
…soft#20665) Previously, we used [the 'browser' field](https://github.com/defunctzombie/package-browser-field-spec) to implement different entry points for browser vs. node. This field does not appear to be supported by CloudPack. Instead, we now use [conditional exports](https://nodejs.org/docs/latest-v18.x/api/packages.html#conditional-exports) in the export map.
…soft#20665) Previously, we used [the 'browser' field](https://github.com/defunctzombie/package-browser-field-spec) to implement different entry points for browser vs. node. This field does not appear to be supported by CloudPack. Instead, we now use [conditional exports](https://nodejs.org/docs/latest-v18.x/api/packages.html#conditional-exports) in the export map.
Previously, we used the 'browser' field to implement different entry points for browser vs. node.
This field does not appear to be supported by CloudPack. Instead, we now use conditional exports in the export map.