2019-01-17 04:06:06 +03:00
|
|
|
/*---------------------------------------------------------------------------------------------
|
|
|
|
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
|
|
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
|
|
*--------------------------------------------------------------------------------------------*/
|
|
|
|
|
|
|
|
//@ts-check
|
|
|
|
|
2019-01-24 04:25:14 +03:00
|
|
|
// See https://github.com/Microsoft/vscode-azuretools/wiki/webpack for guidance
|
2019-01-17 04:06:06 +03:00
|
|
|
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const process = require('process');
|
2019-01-25 00:27:39 +03:00
|
|
|
const CopyWebpackPlugin = require('copy-webpack-plugin');
|
2019-01-17 04:06:06 +03:00
|
|
|
const StringReplacePlugin = require("string-replace-webpack-plugin");
|
2019-01-24 04:25:14 +03:00
|
|
|
const dev = require("vscode-azureextensiondev");
|
2019-01-17 04:06:06 +03:00
|
|
|
|
|
|
|
let DEBUG_WEBPACK = !!process.env.DEBUG_WEBPACK;
|
|
|
|
|
2019-01-24 04:25:14 +03:00
|
|
|
let config = dev.getDefaultWebpackConfig({
|
|
|
|
projectRoot: __dirname,
|
2019-02-13 05:50:11 +03:00
|
|
|
verbosity: DEBUG_WEBPACK ? 'debug' : 'normal',
|
2019-01-24 04:25:14 +03:00
|
|
|
|
|
|
|
externalNodeModules: [
|
|
|
|
// Modules that we can't easily webpack for some reason.
|
|
|
|
// These and their dependencies will be copied into node_modules rather than placed in the bundle
|
|
|
|
// Keep this list small, because all the subdependencies will also be excluded
|
|
|
|
'gremlin',
|
|
|
|
'socket.io',
|
2019-02-14 04:42:20 +03:00
|
|
|
'd3'
|
2019-01-24 04:25:14 +03:00
|
|
|
],
|
|
|
|
entries: {
|
2019-01-17 04:06:06 +03:00
|
|
|
// Note: Each entry is a completely separate Node.js application that cannot interact with any
|
|
|
|
// of the others, and that individually includes all dependencies necessary (i.e. common
|
|
|
|
// dependencies will have a copy in each entry file, no sharing).
|
|
|
|
},
|
|
|
|
|
2019-01-24 04:25:14 +03:00
|
|
|
externals:
|
|
|
|
{
|
|
|
|
// Fix "Module not found" errors in ./node_modules/websocket/lib/{BufferUtil,Validation}.js
|
|
|
|
// and 'ws' module.
|
|
|
|
// 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.
|
|
|
|
}, // end of externals
|
|
|
|
|
|
|
|
loaderRules: [
|
|
|
|
], // end of loaderRules
|
2019-01-17 04:06:06 +03:00
|
|
|
|
2019-02-14 04:42:20 +03:00
|
|
|
|
2019-01-24 04:25:14 +03:00
|
|
|
plugins: [
|
2019-01-25 00:27:39 +03:00
|
|
|
// Copy files to dist folder where the runtime can find them
|
|
|
|
new CopyWebpackPlugin([
|
2019-02-14 04:42:20 +03:00
|
|
|
// graphClient.js -> dist, which is used by graphClient.html
|
|
|
|
{ from: './out/src/graph/client/graphClient.js', to: 'graphClient.js' }
|
2019-08-06 21:36:34 +03:00
|
|
|
]),
|
|
|
|
|
|
|
|
// An instance of the StringReplacePlugin plugin must be present for it to work (its use is configured in modules).
|
|
|
|
new StringReplacePlugin()
|
2019-01-25 00:27:39 +03:00
|
|
|
]
|
2019-01-24 04:25:14 +03:00
|
|
|
});
|
2019-01-17 04:06:06 +03:00
|
|
|
|
|
|
|
if (DEBUG_WEBPACK) {
|
|
|
|
console.log('Config:', config);
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = config;
|