-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Builder not working right with Angular Material - Attempting to attach an unknown Portal type #801
Comments
I don't have a lot of context about Module Federation here, but out of curiosity I've looked more. I believe the issue could be?! that the shared chunks that are now part of e.g. module-federation-plugin/libs/mf/src/utils/share-utils.ts Lines 201 to 213 in 8dbc749
|
i have the same error and the same warnings. any updates here? |
Have you tried downgrading Angular Material? It worked for me. |
I have created a workaround. This script is bundling the parts of cdk, that are important to me, into one cdk-bundle. import { glob } from "glob";
import path from "node:path";
import fs from "node:fs/promises";
const include = ["a11y", "drag-drop", "overlay", "portal", "scrolling"];
const includeRegex = new RegExp(`(${include.join("|")}).mjs$`);
const cdkPath = "./node_modules/@angular/cdk";
const cdkScriptPath = path.resolve(cdkPath, "fesm2022");
const definitionPath = path.resolve(cdkPath, "cdk-bundle");
const packageJsonFilePath = path.resolve(cdkPath, "package.json");
const bundleFilePath = path.resolve(cdkScriptPath, "cdk-bundle.mjs");
const definitionFilePath = path.resolve(definitionPath, "index.d.ts");
try {
await fs.mkdir(definitionPath);
} catch (e) {
if (e.code !== "EEXIST") {
throw e;
}
}
// read the package parts to include
const files = glob.sync(`${cdkScriptPath}/*.mjs`).filter((file) => {
return (
!file.match(/-[a-z0-9]{8}\.mjs$/) &&
!file.match(/(testing|cdk-bundle)\.mjs$/) &&
file.match(includeRegex)
);
});
// create the definition file
await fs.writeFile(
definitionFilePath,
files
.map((file) => {
const fileName = path.basename(file).replace(/\.mjs$/, "");
return `export * from '../${fileName}'`;
})
.join("\n"),
{ encoding: "utf-8" },
);
// create the bundle file
await fs.writeFile(
bundleFilePath,
files
.map((file) => {
const fileName = path.basename(file);
return `export * from './${fileName}'`;
})
.join("\n"),
{ encoding: "utf-8" },
);
// update the package.json file
const packageJson = JSON.parse(
await fs.readFile(packageJsonFilePath, { encoding: "utf-8" }),
);
packageJson.exports["./cdk-bundle"] = {
types: "./cdk-bundle/index.d.ts",
default: "./fesm2022/cdk-bundle.mjs",
};
await fs.writeFile(
packageJsonFilePath,
JSON.stringify(packageJson, null, 2),
{ encoding: "utf-8" },
); |
It's connected to #819 and it will be solved very soon. |
works now. |
With what library do you have an issue?
native-federation
Reproduction of the bug/regression with instructions
I am using this lib in an NX monorepo. I am implementing a header-nav in a publishable lib which contains a
mat-menu
. When I try to use this header-nav and click themat-menu
trigger, I get the following error:I have already opened a ticket at the official Angular components repo and @devversion could confirm that with your builder two CDK version are existing: angular/components#30686 (comment)
I have already built a reproduction of the error in a public repo: https://github.com/JuNe98/nx-menu-bug
I also can confirm that the error only come up in Angular Material Version 19.2.4 or newer. 19.2.3 works fine.
Expected behavior
I would expect open the
mat-menu
causing no error.Versions of Native/Module Federation, Angular, Node, Browser, and operating system
Native Federation: 19.0.16
Angular: 19.2.3
Angular Material: >=19.2.4
Other information
No response
I would be willing to submit a PR to fix this issue
The text was updated successfully, but these errors were encountered: