-
Notifications
You must be signed in to change notification settings - Fork 9
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
addModuleImportToRootModule doesn't affect the appModule #23
Comments
Hi there! |
is there any update on this @nitayneeman |
Hi, I did some digging and found the problem here export function addModuleImportToModule(host: Tree, modulePath: string, moduleName: string, src: string) {
const moduleSource = getSourceFile(host, modulePath);
if (!moduleSource) {
throw new SchematicsException(`Module not found: ${modulePath}`);
}
//this is fine
const changes = addImportToModule(<any>moduleSource, modulePath, moduleName, src);
const recorder = host.beginUpdate(modulePath);
changes.forEach(change => {
if (change instanceof InsertChange) { // <= this always returns false
recorder.insertLeft(change.pos, change.toAdd);
}
});
host.commitUpdate(recorder);
} the changes array contains the correct changes (the file import and the import in the ngModule) but this check : |
Either cast it explicitly or use angular/schematics not from utilities. Read it here |
I made it work using @schematics/angular, but it's still a bug IMO. I cannot cast it myself as the code that is faulty is in the schematics-utilities library. |
KO in 2.0.0 and 2.0.1
OK in 1.1.3
Here is my rule factory function
Here is what I got in console
But my app.module.ts is absolutely the same as before.
I could downgrade to 1.1.3 but I need to set configuration for my modules, but then I got this issue:
#7
What am I supposed to do?
P.S. Where I can find a comprehensive list of the API your package expoes? Thank you?
The text was updated successfully, but these errors were encountered: