Webpack 5 compatibility and crypto dependency when importing @azure/msal-node #7395
Labels
bug-unconfirmed
A reported bug that needs to be investigated and confirmed
confidential-client
Issues regarding ConfidentialClientApplications
msal-node
Related to msal-node package
question
Customer is asking for a clarification, use case or information.
Core Library
MSAL Node (@azure/msal-node)
Core Library Version
2.15.0
Wrapper Library
Not Applicable
Wrapper Library Version
0
Public or Confidential Client?
Confidential
Description
Hello,
I'm trying to build the node exemple provided in an existing Webpack5 config running on node 18.
As soon as I import the class "ConfidentialClientApplication" from @azure/msal-node, I get the following error on build :
"./node_modules/@azure/msal-node/dist/crypto/HashUtils.mjs" contains a reference to the file "crypto".
This file can not be found, please check it for typos or update it if the file got moved.
Reading this closed issue, I tried to add aliases and polyfill to my webpack config.
For exemple, adding this :
config.resolve.fallback = {
crypto: require.resolve('crypto-browserify'),
But once crypto error is fixed, I get a lot of other libs not found anymore, like http, https, process, path etc...
Error Message
"./node_modules/@azure/msal-node/dist/crypto/HashUtils.mjs" contains a reference to the file "crypto".
This file can not be found, please check it for typos or update it if the file got moved.
MSAL Logs
No response
Network Trace (Preferrably Fiddler)
MSAL Configuration
Relevant Code Snippets
Reproduction Steps
Expected Behavior
should not get an error at build
Identity Provider
Entra ID (formerly Azure AD) / MSA
Browsers Affected (Select all that apply)
Chrome, Firefox
Regression
No response
The text was updated successfully, but these errors were encountered: