build: ensure material dependencies are properly linked for devtools (#60822)

This is a follow-up to the recent devtools linking change, leveraging
the dedicated package that we are also using in the components
repository; avoiding future duplication.

The latest version of that package contains a fix for an issue where
the linked bundles did not rewrite imports to shared chunks.

Such imports need to also point to their linked variants.

PR Close #60822
This commit is contained in:
Paul Gschwendtner
2025-04-10 07:47:21 +00:00
committed by kirjs
parent 6aa0bbd4e4
commit 5c575a8ac9
4 changed files with 36 additions and 27 deletions
+1
View File
@@ -12,6 +12,7 @@ nodejs_binary(
":linker_srcs",
"//packages/compiler-cli/linker/babel",
"@npm//@babel/core",
"@npm//@nginfra/angular-linking",
"@npm//tinyglobby",
],
entry_point = ":index.mjs",
+5 -25
View File
@@ -35,33 +35,13 @@ async function main() {
}),
);
const fesmBundles = globSync('fesm2022/**/*.mjs', {cwd: outDir});
const tasks = [];
const babelOptions = {
plugins: [
[
linkerBabelPlugin,
{
// We compile with an unstamped version of the compiler, so ignore.
unknownDeclarationVersionHandling: 'ignore',
},
],
],
};
process.chdir(outDir);
for (const bundleFile of fesmBundles) {
tasks.push(
(async () => {
const filePath = path.join(outDir, bundleFile);
const content = await readFile(filePath, 'utf8');
const result = await transformAsync(content, {...babelOptions, filename: filePath});
// We compile with an unstamped version of the compiler, so ignore.
process.env['LINKER_UNKNOWN_DECLARATION_VERSION_HANDLING'] = 'ignore';
await writeFile(path.join(outDir, bundleFile), result.code);
})(),
);
}
await Promise.all(tasks);
// Run linking in cwd.
import('@nginfra/angular-linking');
}
main().catch((e) => {