nx
nx copied to clipboard
Add documentation how to create a custom inferred tasks plugin
Documentation issue
- [ ] Reporting a typo
- [ ] Reporting a documentation bug
- [X] Documentation improvement
- [ ] Documentation feedback
Is there a specific documentation page you are reporting?
n/a
Additional context or description
I want to create a custom tsc check plugin using inferred tasks, but there is no documentation on how to do this.
When following this documentation: https://nx.dev/extending-nx/recipes/project-graph-plugins
I get the following error: Inner Error: Error: Jest: Failed to parse the TypeScript config file libs/xxx/jest.config.ts TSError: ⨯ Unable to compile TypeScript: libs/xxx/jest.config.ts(11,7): error TS2451: Cannot redeclare block-scoped variable '_default'.
While i didn't add anything: import { CreateNodes, CreateNodesContext, readJsonFile } from '@nx/devkit'; import { dirname } from 'path';
export const createNodes: CreateNodes = [ '**/project.json', (projectConfigurationFile: string, opts, context: CreateNodesContext) => { const projectConfiguration = readJsonFile(projectConfigurationFile); const root = dirname(projectConfigurationFile);
return {
projects: {
[root]: projectConfiguration,
},
};
}, ];
I have encountered same error, and i am not certain if this has to do with me making a mistake in piecing together information across the guides or there is an issue with jest plugin.
Here is barebones reproduction repo: https://github.com/epliXs/nx-plugin-debug
The error is intermittent, the most consistent way of reproducing it is:
npx nx resetnpx nx run foobar-a:echo
Thanks for reporting this!
Could you please expand on what piece of extra information you feel is needed or would like to see in the https://nx.dev/extending-nx/recipes/project-graph-plugins recipe? We recently added some extra information to that page.
The error reported is unrelated to the plugin you've created. It's an error thrown from the @nx/jest/plugin, and that's a separate issue. Please let's keep this issue focused on the documentation improvements you think are needed. If the issue's purpose was actually to get help on how to address that error, we can update the description and focus on that instead. Otherwise, feel free to create a separate issue for the Jest plugin error.
This issue has been automatically marked as stale because more information has not been provided within 7 days. It will be closed in 21 days if no information is provided. If information has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏
Created https://github.com/nrwl/nx/issues/26245 for the issue with the jest plugin
This issue has been automatically marked as stale because more information has not been provided within 7 days. It will be closed in 21 days if no information is provided. If information has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏
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.