esm - introduce VSCODE_BUILD_ESM variable (#225586)

This commit is contained in:
Benjamin Pasero
2024-08-14 14:49:26 +02:00
committed by GitHub
parent 7f4969a41e
commit 0dea4804f4
22 changed files with 960 additions and 57 deletions

View File

@@ -15,6 +15,7 @@ import { referenceGeneratedDepsByArch as rpmGeneratedDeps } from './rpm/dep-list
import { DebianArchString, isDebianArchString } from './debian/types';
import { isRpmArchString, RpmArchString } from './rpm/types';
import product = require('../../product.json');
import { isESM } from '../lib/esm';
// A flag that can easily be toggled.
// Make sure to compile the build directory after toggling the value.
@@ -47,7 +48,8 @@ export async function getDependencies(packageType: 'deb' | 'rpm', buildDir: stri
}
// Get the files for which we want to find dependencies.
const nativeModulesPath = path.join(buildDir, 'resources', 'app', 'node_modules.asar.unpacked');
const canAsar = !isESM('ASAR disabled in Linux builds'); // TODO@esm ASAR disabled in ESM
const nativeModulesPath = path.join(buildDir, 'resources', 'app', canAsar ? 'node_modules.asar.unpacked' : 'node_modules');
const findResult = spawnSync('find', [nativeModulesPath, '-name', '*.node']);
if (findResult.status) {
console.error('Error finding files:');