Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 26 additions & 5 deletions extensions/microsoft-authentication/extension.webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,20 +8,41 @@ import CopyWebpackPlugin from 'copy-webpack-plugin';
import path from 'path';

const isWindows = process.platform === 'win32';
const windowsArches = ['x64'];
const isMacOS = process.platform === 'darwin';
const macOSArches = ['arm64'];
const isLinux = !isWindows && !isMacOS;

const windowsArches = ['x64'];
const linuxArches = ['x64'];

let platformFolder;
switch (process.platform) {
case 'win32':
platformFolder = 'windows';
break;
case 'darwin':
platformFolder = 'macos';
break;
case 'linux':
platformFolder = 'linux';
break;
default:
throw new Error(`Unsupported platform: ${process.platform}`);
}

const arch = process.arch;
const arch = process.env.VSCODE_ARCH || process.arch;
console.log(`Building Microsoft Authentication Extension for ${process.platform} (${arch})`);

const plugins = [...nodePlugins(import.meta.dirname)];
if ((isWindows && windowsArches.includes(arch)) || (isMacOS && macOSArches.includes(arch))) {
if (
(isWindows && windowsArches.includes(arch)) ||
isMacOS ||
(isLinux && linuxArches.includes(arch))
Comment on lines +36 to +39
Copy link

Copilot AI Nov 21, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

macOS is now included unconditionally without architecture filtering (line 38), while Windows and Linux still filter by architecture (lines 37, 39). This inconsistency could be intentional to support both Intel (x64) and ARM64 Macs, but the from pattern on line 45 uses ${arch} which will still be architecture-specific. This means the copy will fail for unsupported architectures if the native files don't exist in that path. Consider either:

  1. Adding architecture filtering for macOS if only specific architectures are supported, or
  2. Documenting that all macOS architectures are supported and ensuring native files exist for all architectures in the expected paths.

Copilot uses AI. Check for mistakes.
) {
plugins.push(new CopyWebpackPlugin({
patterns: [
{
// The native files we need to ship with the extension
from: '**/dist/(lib|)msal*.(node|dll|dylib)',
from: `**/dist/${platformFolder}/${arch}/(lib|)msal*.(node|dll|dylib|so)`,
to: '[name][ext]'
}
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ export class CachedPublicClientApplication implements ICachedPublicClientApplica

const loggerOptions = new MsalLoggerOptions(_logger, telemetryReporter);
let broker: BrokerOptions | undefined;
if (process.platform !== 'win32' && process.platform !== 'darwin') {
this._logger.info(`[${this._clientId}] Native Broker is only available on Windows and macOS`);
} else if (env.uiKind === UIKind.Web) {
if (env.uiKind === UIKind.Web) {
this._logger.info(`[${this._clientId}] Native Broker is not available in web UI`);
} else if (workspace.getConfiguration('microsoft-authentication').get<'msal' | 'msal-no-broker'>('implementation') === 'msal-no-broker') {
this._logger.info(`[${this._clientId}] Native Broker disabled via settings`);
Expand Down
Loading