I am developing a Microsoft 365 / Office 2013 - 2021 Taskpane Add-in using Visual Studio Code that is written in JavaScript. The meat and potatoes of the add-in work. It's the sides that are causing trouble. To elaborate, I find myself stuck trying to implement Azure Single Sign-On and KeyVault access, as I've encountered an error concerning any and every Azure credential type I've attempted to use from DefaultAzureCredential to InteractiveBrowserCredential.

During compilation, I receive the following error:

ERROR in ./node_modules/@azure/identity/dist-esm/src/credentials/azureDeveloperCliCredential.js 5:0-42

Module not found: Error: Can't resolve 'child_process' in 'C:\Users\...\node_modules\@azure\identity\dist-esm\src\credentials'

Upon examination of azureDeveloperCliCredential.js, line 05 plainly states import child_process from "child_process";. I tried commenting on that line. That results in a myriad of errors during compile time. I also tried setting child_process to 'false' / 'empty' in the webpack.config.js file and the package.json file - The dev server will not run the add-in with child_process set as such. I'm aware that certain processes can and can't be spawned from the browser; however, what's causing the error is server-side code that shouldn't be causing errors...right? Any help is greatly appreciated!

2

There are 2 best solutions below

0
On

This looks to be a bug that has been fixed by https://github.com/Azure/azure-sdk-for-js/pull/27097. The latest version @azure/identity should work.

0
On

After much research here on StackOverflow, the solution was to mark child_process: "false" in the package.json file located in .\node_modules\@azure\identity.