Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions babel.config.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,18 @@ module.exports = {
{
resolvePath(sourcePath, currentFile) {
if (sourcePath === "apg-lite") {
const apgLiteCJS = path.resolve("./src/apg-lite.cjs");
// apg-lite.cjs will be in the same cjs/ output directory
// The relative path from src/ needs to account for the output being in cjs/
const srcDir = path.resolve("./src");

Copilot AI Feb 8, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

srcDir is derived from path.resolve("./src"), which depends on the process CWD. If Babel is invoked from a different working directory (e.g., via tooling/monorepo scripts), this resolver can generate incorrect paths. Prefer resolving relative to the config file (e.g., using __dirname) so the mapping is stable regardless of where the command is run.

Suggested change
const srcDir = path.resolve("./src");
const srcDir = path.resolve(__dirname, "src");

Copilot uses AI. Check for mistakes.
const currentDir = path.dirname(currentFile);
return path.relative(currentDir, apgLiteCJS);
const relativeToSrc = path.relative(srcDir, currentDir);
// Path from the output file location to apg-lite.cjs
// Both will be under cjs/, so we need to go up relativeToSrc levels then to apg-lite.cjs
if (relativeToSrc === "") {
return "./apg-lite.cjs";
}
const depth = relativeToSrc.split(path.sep).length;
return "../".repeat(depth) + "apg-lite.cjs";
Comment thread
char0n marked this conversation as resolved.
}
return sourcePath;
},
Expand Down
9 changes: 9 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading