nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.28k stars 2.32k forks source link

Handling for the @nrwl/devkit with 3rd party plugins with different versions of Nx #11423

Closed DominikPieper closed 2 years ago

DominikPieper commented 2 years ago

Good morning,

I have a bug or question. Not sure yet.

The plugin API from @nrwl/devkit works great but if the versions don't match there is a problem with the exports I believe. I'm not sure how to handle them. Is there a way to be backward compatible?

Current Behavior

Example: My latest @nxext/stencil plugin depends on @nrwl/devkit@14.5.2. Works great with the latest Nx but with older versions (tested here with 14.1.9) it fails.

Expected Behavior

Should work with older and new versions.

Steps to Reproduce

npx create-nx-workspace@14.1.9 devkit-test
npm install -D @nxext/stencil
npx nx g @nxext/stencil:lib lib

Failure Logs

npx nx g @nxext/stencil:lib lib
✔ Which stylesheet format would you like to use? · css
Cannot find module 'nx/src/config/configuration'
Require stack:
- /private/tmp/devkit-test/node_modules/@nxext/stencil/node_modules/@nrwl/devkit/index.js
- /private/tmp/devkit-test/node_modules/@nxext/stencil/src/generators/library/generator.js
- /private/tmp/devkit-test/node_modules/nx/src/config/workspaces.js
- /private/tmp/devkit-test/node_modules/nx/src/command-line/generate.js
- /private/tmp/devkit-test/node_modules/nx/src/command-line/nx-commands.js
- /private/tmp/devkit-test/node_modules/nx/bin/init-local.js
- /private/tmp/devkit-test/node_modules/nx/bin/nx.js

Environment

>  NX   Report complete - copy this into the issue template

   Node : 16.13.1
   OS   : darwin x64
   npm  : 8.10.0

   nx : 14.1.9
   @nrwl/angular : Not Found
   @nrwl/cypress : Not Found
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.1.9
   @nrwl/eslint-plugin-nx : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 14.1.9
   @nrwl/js : Not Found
   @nrwl/linter : 14.1.9
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/workspace : 14.1.9
   typescript : 4.6.4
   ---------------------------------------
   Community plugins:
     @nxext/stencil: 14.0.5
github-actions[bot] commented 1 year ago

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.