[Identity] Enable @azure/identity to build for the browser#4165
[Identity] Enable @azure/identity to build for the browser#4165daviwil merged 12 commits intoAzure:masterfrom
Conversation
sdk/identity/identity/src/credentials/clientCertificateCredential.ts
Outdated
Show resolved
Hide resolved
|
OK, I think this is looking much better now. Question for @bterlson: should we be shimming Node-only classes to In the generated browser bundle I see the |
|
In the storage case it worked because we were shimming functionality that would disappear completely in the browser build. Since this is shimming exported surface area, it's probably a good idea to give good errors if possible! |
sadasant
left a comment
There was a problem hiding this comment.
Looks good!! Can't wait to try it.
2ce01be to
bf83958
Compare
|
OK, added |
| import cjs from "rollup-plugin-commonjs"; | ||
| import replace from "rollup-plugin-replace"; | ||
| import { uglify } from "rollup-plugin-uglify"; | ||
| import { terser } from "rollup-plugin-terser"; |
There was a problem hiding this comment.
Is this change required for the other sdks?
There was a problem hiding this comment.
Probably so, I'll open a separate PR to make that change everywhere then we can decide whether to merge it.
I've addressed the comments in earlier changes
|
Going to merge this now to unblock other work. If anyone has any further comments I'll be happy to open another PR to address them. Thanks all! |
This change makes some tweaks to
@azure/identityto enable it to build for and be used successfully in the browser. This is the first step toward adding user authentication in the browser for Preview 2.The largest part of the change is breaking out all of
IdentityClient'sauthenticate*methods into the individualCredentialclasses that use them so that they can be conditionally included in the browser build. I'm also stubbing outClientCertificateCredential,ManagedIdentityCredential, andEnvironmentCredentialentirely because they rely on the Node.js environment and modules.I've tested that this works successfully using an example project that pulls
@azure/identityin to a Webpack build that runs in the browser. I'll send a separate PR for that example project once it's ready.