Skip to content
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

Improve platform checks for bundles #5210

Closed
bterlson opened this issue Sep 20, 2019 · 2 comments
Closed

Improve platform checks for bundles #5210

bterlson opened this issue Sep 20, 2019 · 2 comments
Labels
Client This issue points to a problem in the data-plane of the library. EngSys This issue is impacting the engineering system.

Comments

@bterlson
Copy link
Member

We presently use rollup-plugin-replace to do static replacement of the pattern if (isNode) with if (true) or if (false) depending on the target platform. This works but is brittle.

A better approach is to remove the replace plugin and have a platform.node.js and platform.browser.js that has export const isNode = true and export const isNode = false respectively. These files are then mapped using the standard browser field in package.json. This will allow Rollup's tree shaker to work regardless of the syntactic pattern used, and would even work should we decide to support additional platform constants like isElectron. It will also work with other bundlers' tree shakers as well, resulting in more optimal bundles for our consumers.

@loarabia loarabia added the Client This issue points to a problem in the data-plane of the library. label Sep 23, 2019
@jeremymeng jeremymeng added the EngSys This issue is impacting the engineering system. label Sep 17, 2021
@dpwatrous
Copy link
Member

Any updates on this? It seems like this would address issues we're seeing trying to use the SDKs in an Electron app. We're adding a very kludgey workaround to force isNode to resolve to false in Electron browser windows with nodeIntegration set to true.

Related issue: #21110

Copy link

Hi @bterlson, we deeply appreciate your input into this project. Regrettably, this issue has remained inactive for over 2 years, leading us to the decision to close it. We've implemented this policy to maintain the relevance of our issue queue and facilitate easier navigation for new contributors. If you still believe this topic requires attention, please feel free to create a new issue, referencing this one. Thank you for your understanding and ongoing support.

@github-actions github-actions bot closed this as not planned Won't fix, can't repro, duplicate, stale Mar 22, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Mar 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Client This issue points to a problem in the data-plane of the library. EngSys This issue is impacting the engineering system.
Projects
None yet
Development

No branches or pull requests

4 participants