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