Keep path mappings for addons after core migration

Follow-up to https://github.com/xtermjs/xterm.js/issues/5896 / PR #5966.

Converting addons to ../../../src/common relative imports broke unit tests:
esbuild emits addon code under addons/*/out-esbuild/ without mirroring the
shared tree, so Node could not load TypeScript sources at runtime
(Cannot find module '../../../src/common/Lifecycle').

Core src/, test/, and headless continue to use relative imports with no
common/* path mappings. Addons keep the prior model until build layout
can share out-esbuild the same way as the main package.

Changes:
- Restore common/* and browser/* paths in addon src/test/benchmark tsconfigs
- Revert addon imports to common/ and browser/ path-mapped specifiers
- Restore NODE_PATH=out-esbuild in bin/test_unit.js for Mocha resolution
- Restore webpack resolve.alias on addons that bundle against out/

Fixes CI test-unit failures on remove-path-mappings-5896.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Daniel Imms
2026-05-31 09:25:12 -07:00
co-authored by Cursor
parent 17ad33dc3d
commit 5d8da19c44
68 changed files with 305 additions and 177 deletions
+6 -2
View File
@@ -8,6 +8,10 @@ const path = require('path');
const COVERAGE_LINES_THRESHOLD = 40;
// Add `out-esbuild` to NODE_PATH so addon path-mapped imports (common/*, browser/*) resolve.
const env = { ...process.env };
env.NODE_PATH = path.resolve(__dirname, '../out-esbuild');
let testFiles = ['**/out-esbuild/**/*.test.js'];
let flagArgs = [];
@@ -42,7 +46,7 @@ if (checkCoverage) {
args,
{
cwd: path.resolve(__dirname, '..'),
env: process.env,
env,
shell: true,
stdio: 'inherit'
}
@@ -55,7 +59,7 @@ const run = cp.spawnSync(
[...testFiles, ...flagArgs],
{
cwd: path.resolve(__dirname, '..'),
env: process.env,
env,
shell: true,
stdio: 'inherit'
}