We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Writing a custom nx generator I am trying to import the angular utility addProviderToComponent:
addProviderToComponent
import { addProviderToComponent } from '@nx/angular/src/utils';
Unfortunately, I am getting an error:
Cannot find module '@nx/angular/src/utils' or its corresponding type declarations.ts(2307)
The generator is running happily but the build throws an error.
Please also have a look at the "Additional Information" provided at the bottom.
There should be no error and it should be easy to use this helper function.
Try to use addProviderToComponent within a generator:
const componentPath = 'apps/my-app/src/app/app.component.ts'; const text = tree.read(componentPath); const sourceX = ts.createSourceFile(componentPath, text.toString(), ts.ScriptTarget.Latest, true); addProviderToComponent(tree, sourceX, componentPath, 'MyProvider');
Cannot run the nx report due to an invalid token in my path: Error: Cannot find module 'C:\Users\T├╝m...
But I am using version:
"nx": "~18.0.7", "@nx/angular": "~18.0.7", "@nx/cypress": "~18.0.7", "@nx/eslint": "~18.0.7", "@nx/eslint-plugin": "~18.0.7", "@nx/devkit": "~18.0.7", "@nx/js": "~18.0.7", "@nx/plugin": "~18.0.7", "@nx/storybook": "~18.0.7", "@nx/web": "~18.0.7", "@nx/workspace": "~18.0.7",
In the folder @nx\angular\src\utils I see the file public-api.d.ts with the following content:
export { isStandalone, addImportToComponent, addImportToDirective, addImportToPipe, addImportToModule, addProviderToBootstrapApplication, addProviderToAppConfig, addProviderToComponent, addProviderToModule, } from './nx-devkit/ast-utils'; export { addRoute, addProviderToRoute } from './nx-devkit/route-utils';
If I place an index.ts file in the same location with the same content, everything works as expected.
Is there an index.ts file missing? Is there another way to import this functionality?
The text was updated successfully, but these errors were encountered:
A related change was introduced with the 3895696 and it all started here: #15669. Any idea @Coly010?
Sorry, something went wrong.
Hi, I have the same issue trying to use the addRoute function. I'm on Ubuntu 22.04.4 LTS.
addRoute
Ubuntu 22.04.4 LTS
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
leosvelperez
Successfully merging a pull request may close this issue.
Current Behavior
Writing a custom nx generator I am trying to import the angular utility
addProviderToComponent
:import { addProviderToComponent } from '@nx/angular/src/utils';
Unfortunately, I am getting an error:
The generator is running happily but the build throws an error.
Please also have a look at the "Additional Information" provided at the bottom.
Expected Behavior
There should be no error and it should be easy to use this helper function.
Steps to Reproduce
Try to use addProviderToComponent within a generator:
const componentPath = 'apps/my-app/src/app/app.component.ts';
const text = tree.read(componentPath);
const sourceX = ts.createSourceFile(componentPath, text.toString(), ts.ScriptTarget.Latest, true);
addProviderToComponent(tree, sourceX, componentPath, 'MyProvider');
Nx Report (custom)
Cannot run the nx report due to an invalid token in my path:
Error: Cannot find module 'C:\Users\T├╝m...
But I am using version:
Operating System
Additional Information
In the folder @nx\angular\src\utils I see the file public-api.d.ts with the following content:
If I place an index.ts file in the same location with the same content, everything works as expected.
Is there an index.ts file missing?
Is there another way to import this functionality?
The text was updated successfully, but these errors were encountered: