Просмотр исходного кода

Adds build hack because of vsls package issues

main
Eric Amodio 6 лет назад
Родитель
Сommit
c72a824f76
1 измененных файлов: 32 добавлений и 0 удалений
  1. +32
    -0
      webpack.config.js

+ 32
- 0
webpack.config.js Просмотреть файл

@ -19,6 +19,38 @@ module.exports = function(env, argv) {
env.optimizeImages = true;
}
// TODO: Total and complete HACK until the following vsls issues are resolved
// https://github.com/MicrosoftDocs/live-share/issues/1334 & https://github.com/MicrosoftDocs/live-share/issues/1335
const vslsPatchRegex = /const liveShareApiVersion = require\(path\.join\(__dirname, 'package\.json'\)\)\.version;/;
let vslsPath = path.resolve(__dirname, 'node_modules/vsls/package.json');
if (fs.existsSync(vslsPath)) {
const vsls = require(vslsPath);
if (vsls.main === undefined) {
vsls.main = 'vscode.js';
fs.writeFileSync(vslsPath, `${JSON.stringify(vsls, undefined, 4)}\n`, 'utf8');
}
vslsPath = path.resolve(__dirname, 'node_modules/vsls/vscode.js');
if (fs.existsSync(vslsPath)) {
console.log(vslsPath);
let code = fs.readFileSync(vslsPath, 'utf8');
if (vslsPatchRegex.test(code)) {
console.log('found');
code = code.replace(
vslsPatchRegex,
`const liveShareApiVersion = '${
vsls.version
}'; // require(path.join(__dirname, 'package.json')).version;`
);
console.log(code);
fs.writeFileSync(vslsPath, code, 'utf8');
}
}
}
return [getExtensionConfig(env), getUIConfig(env)];
};

Загрузка…
Отмена
Сохранить