mirror of
https://github.com/angular/angular.git
synced 2026-09-14 13:54:52 +08:00
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:
@@ -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",
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
Reference in New Issue
Block a user