Path: blob/main/extensions/microsoft-authentication/extension.webpack.config.js
3309 views
/*---------------------------------------------------------------------------------------------1* Copyright (c) Microsoft Corporation. All rights reserved.2* Licensed under the MIT License. See License.txt in the project root for license information.3*--------------------------------------------------------------------------------------------*/4// @ts-check5import withDefaults, { nodePlugins } from '../shared.webpack.config.mjs';6import CopyWebpackPlugin from 'copy-webpack-plugin';7import path from 'path';89const isWindows = process.platform === 'win32';10const windowsArches = ['x64'];11const isMacOS = process.platform === 'darwin';12const macOSArches = ['arm64'];1314const arch = process.arch;15console.log(`Building Microsoft Authentication Extension for ${process.platform} (${arch})`);1617const plugins = [...nodePlugins(import.meta.dirname)];18if ((isWindows && windowsArches.includes(arch)) || (isMacOS && macOSArches.includes(arch))) {19plugins.push(new CopyWebpackPlugin({20patterns: [21{22// The native files we need to ship with the extension23from: '**/dist/(lib|)msal*.(node|dll|dylib)',24to: '[name][ext]'25}26]27}));28}2930export default withDefaults({31context: import.meta.dirname,32entry: {33extension: './src/extension.ts'34},35externals: {36// The @azure/msal-node-runtime package requires this native node module (.node).37// It is currently only included on Windows, but the package handles unsupported platforms38// gracefully.39'./msal-node-runtime': 'commonjs ./msal-node-runtime'40},41resolve: {42alias: {43'keytar': path.resolve(import.meta.dirname, 'packageMocks', 'keytar', 'index.js')44}45},46plugins47});484950