You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
While attempting to import this library into Automattic/wp-calypso I ran into unexpected problems as a result of the node core imports. Calypso's webpack configs explicitly exclude the built-in polyfills with node: false as the setting. As a result this fails to build properly there and is unusable.
While this can be resolved in Calypso it's indicative that this library doesn't follow what has become a standard for handling these cases: either use libraries which run in both node and in the browser; or use the "browser" field in package.json to provide replacement modules for the browser context.
In this patch we're applying both techniques to make this work in more contexts. We've replaced the use of util.inherits with the inherits package and replaced the use of util.format with string template literals. Finally instead of importing a generic requests library we're including native versions of the request mechanism for node and for the browser and using the "browser" field to choose the proper one.
0 commit comments