mirror of
https://github.com/Microsoft/vscode
synced 2024-10-05 19:02:54 +00:00
Fix extension private prop mangling when compiling all projects (#167464)
#167269
This commit is contained in:
parent
cf01f3bb99
commit
725330a7cd
|
@ -7,17 +7,26 @@
|
|||
const webpack = require('webpack');
|
||||
const { Mangler } = require('../build/lib/mangleTypeScript');
|
||||
|
||||
let map;
|
||||
/**
|
||||
* Map of project paths to mangled file contents
|
||||
*
|
||||
* @type {Map<string, Map<string, string>>}
|
||||
*/
|
||||
const mangleMap = new Map();
|
||||
|
||||
/**
|
||||
* @param {string} projectPath
|
||||
*/
|
||||
function getMangledFileContents(projectPath) {
|
||||
if (!map) {
|
||||
let entry = mangleMap.get(projectPath);
|
||||
if (!entry) {
|
||||
console.log(`Mangling ${projectPath}`);
|
||||
const ts2tsMangler = new Mangler(projectPath, console.log);
|
||||
map = ts2tsMangler.computeNewFileContents();
|
||||
entry = ts2tsMangler.computeNewFileContents();
|
||||
mangleMap.set(projectPath, entry);
|
||||
}
|
||||
|
||||
return map;
|
||||
return entry;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -15,6 +15,13 @@ const CopyWebpackPlugin = require('copy-webpack-plugin');
|
|||
const { NLSBundlePlugin } = require('vscode-nls-dev/lib/webpack-bundler');
|
||||
const { DefinePlugin, optimize } = require('webpack');
|
||||
|
||||
const tsLoaderOptions = {
|
||||
compilerOptions: {
|
||||
'sourceMap': true,
|
||||
},
|
||||
onlyCompileBundledFiles: true,
|
||||
};
|
||||
|
||||
function withNodeDefaults(/**@type WebpackConfig*/extConfig) {
|
||||
/** @type WebpackConfig */
|
||||
const defaultConfig = {
|
||||
|
@ -42,11 +49,7 @@ function withNodeDefaults(/**@type WebpackConfig*/extConfig) {
|
|||
// configure TypeScript loader:
|
||||
// * enable sources maps for end-to-end source maps
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
compilerOptions: {
|
||||
'sourceMap': true,
|
||||
}
|
||||
}
|
||||
options: tsLoaderOptions
|
||||
}, {
|
||||
loader: path.resolve(__dirname, 'mangle-loader.js'),
|
||||
options: {
|
||||
|
@ -125,11 +128,8 @@ function withBrowserDefaults(/**@type WebpackConfig*/extConfig, /** @type Additi
|
|||
// * enable sources maps for end-to-end source maps
|
||||
loader: 'ts-loader',
|
||||
options: {
|
||||
compilerOptions: {
|
||||
'sourceMap': true,
|
||||
},
|
||||
...tsLoaderOptions,
|
||||
...(additionalOptions ? {} : { configFile: additionalOptions.configFile }),
|
||||
onlyCompileBundledFiles: true,
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue