浏览代码

Adds build hack because of vsls package issues

main
Eric Amodio 6 年前
父节点
当前提交
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)];
};

正在加载...
取消
保存