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
"Cannot find module" of newly generated plugin and generator using @nrwl/nx-plugin #7166
Comments
So after much head scratching, reading every line diff and every generated file I think I've found the problem(s). Firstly, my own bad, to run a package that is being developed locally you need to run 2 commands
Any time you update the package you will need to rebuild the plugin. Secondly I think there is an issue with the In the above example the workspace is created with the name 'test-workspace' which is then used in the package.json and nx.json as the projects name and npmScope respectively. When the plugin is generated the package.json for the plugin is created as below:
I was expecting the import path to effect the plugins package name, but in fact it only changes the import path in the tsconfig file for importing directly in a JS file. So the description on the docs does not fit the actual implementation: How the plugin will be published, like @myorg/my-awesome-plugin. Note this must be a valid npm name Anyway it'd be good to get a reply on this to see if it is a bug, or just a misunderstanding in the docs. |
I have the same issue. Any progress on this @vsavkin ? |
@ChazUK Did you find any work-around to this? Using |
@mdo5004 the only solution I found was documented above using npm link :( |
Suggested solutionSTEP 1Create workspace for developing plugin/plugins. See docs.
Create additional 'aplication' generator for 'imperva' plugin
Run tests
Build plugin
STEP 2Create workspace for consuming plugin/plugins.
Well, now, I'm aware of two approaches how to consume/test plugin locally: SIMPLEImport plugin locally as a file, add this line in "@my-org/imperva": "file:../my-org/dist/packages/imperva"
COMPLEXCreate and run npm registry locally. I'm using Verdaccio.
Hope this helps! |
This will be fixed as part of #9116 |
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. |
Current Behavior
Creating a new plugin and generator using @nrwl/nx-plugin in an empty workspace, fails to find the new plugin.
Expected Behavior
Newly created custom plugin and generator should be able to be ran inside a new empty workspace.
Steps to Reproduce
Starting from a blank empty workspace, and then creating a new plugin using the nx-plugin generator:
Failure Logs
I also tried running
nx build plugins-imperva
to build it but it still won't run.Environment
The text was updated successfully, but these errors were encountered: