50 строки
2.0 KiB
JavaScript
50 строки
2.0 KiB
JavaScript
/*---------------------------------------------------------------------------------------------
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
'use strict';
|
|
|
|
//@ts-check
|
|
|
|
// See https://github.com/Microsoft/vscode-azuretools/wiki/webpack for guidance
|
|
|
|
const process = require('process');
|
|
const dev = require("@microsoft/vscode-azext-dev");
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|
|
|
let DEBUG_WEBPACK = !/^(false|0)?$/i.test(process.env.DEBUG_WEBPACK || '');
|
|
|
|
let config = dev.getDefaultWebpackConfig({
|
|
projectRoot: __dirname,
|
|
verbosity: DEBUG_WEBPACK ? 'debug' : 'normal',
|
|
externals:
|
|
{
|
|
// Fix "Module not found" errors in ./node_modules/websocket/lib/{BufferUtil,Validation}.js
|
|
// These files are not in node_modules and so will fail normally at runtime and instead use fallbacks.
|
|
// Make them as external so webpack doesn't try to process them, and they'll simply fail at runtime as before.
|
|
'../build/Release/validation': 'commonjs ../build/Release/validation',
|
|
'../build/default/validation': 'commonjs ../build/default/validation',
|
|
'../build/Release/bufferutil': 'commonjs ../build/Release/bufferutil',
|
|
'../build/default/bufferutil': 'commonjs ../build/default/bufferutil',
|
|
|
|
// ./getCoreNodeModule.js (path from windowsProcessTree.ts) uses a dynamic require which can't be webpacked
|
|
'./getCoreNodeModule': 'commonjs getCoreNodeModule',
|
|
},
|
|
plugins: [
|
|
// Copy files to dist folder where the runtime can find them
|
|
new CopyWebpackPlugin({
|
|
patterns: [
|
|
// getCoreNodeModule.js -> dist/node_modules/getCoreNodeModule.js
|
|
{ from: './out/src/utils/getCoreNodeModule.js', to: 'node_modules' }
|
|
]
|
|
})
|
|
]
|
|
});
|
|
|
|
if (DEBUG_WEBPACK) {
|
|
console.log('Config:', config);
|
|
}
|
|
|
|
module.exports = config;
|