Skip to content
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 import default exported generators #12434

Closed
BartKoppelmans opened this issue Oct 5, 2022 · 2 comments · Fixed by #12460
Closed

Cannot import default exported generators #12434

BartKoppelmans opened this issue Oct 5, 2022 · 2 comments · Fixed by #12460

Comments

@BartKoppelmans
Copy link

Current Behavior

When importing a default-exported generator such as the @nrwl/angular:remote generator, it cannot be found as exported through the barrel. The import import { remote } from '@nrwl/angular/generators' thus fails to load. Generators that are both exported and default exported (such as @nrwl/workspace:library) seem to work just fine.

Deep exports such as import remote from '@nrwl/angular/src/generators/remote/remote' or import { remote } from '@nrwl/angular/src/generators/remote/remote' seem to fail as will, since the package.json does not export them (as was expected).

Upon first inspection, this seems to also apply other generators following the same export style:

  • @nrwl/angular:remote
  • @nrwl/angular:host
  • @nrwl/angular:convert-to-with-mf

Expected Behavior

The import should be exported normally, as well as default-exported.

Steps to Reproduce

  1. Create a new plugin with generator.
  2. Import the remote generator.
  3. Fails

Failure Logs

TypeError: (0 , _generators.remote) is not a function
    at mcAngularRemoteGeneratorImplementationStep (C:\Users\s155643\Documents\Side_projects\CryptoSimulator\mimicry\packages\workspace\src\generators\angular\remote\generator.ts:49:36)
    at mcAngularRemoteGenerator (C:\Users\s155643\Documents\Side_projects\CryptoSimulator\mimicry\packages\workspace\src\generators\angular\remote\generator.ts:77:36)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Environment

pnx report

 >  NX   Report complete - copy this into the issue template

   Node : 16.14.0
   OS   : win32 x64
   pnpm : 7.12.2

   nx : 14.7.17
   @nrwl/angular : 14.7.17
   @nrwl/cypress : 14.7.17
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.7.17
   @nrwl/eslint-plugin-nx : 14.7.17
   @nrwl/expo : Not Found
   @nrwl/express : Not Found
   @nrwl/jest : 14.7.17
   @nrwl/js : 14.7.17
   @nrwl/linter : 14.7.17
   @nrwl/nest : 14.7.17
   @nrwl/next : Not Found
   @nrwl/node : 14.7.17
   @nrwl/nx-cloud : 14.6.2
   @nrwl/nx-plugin : 14.7.17
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.7.17
   @nrwl/web : 14.7.5
   @nrwl/workspace : 14.7.17
   typescript : 4.8.3
   ---------------------------------------
   Local workspace plugins:
         @mimicry/workspace
         @mimicry/devkit
   ---------------------------------------
   Community plugins:
         @ng-bootstrap/ng-bootstrap: 13.0.0
         @ngrx/component-store: 14.3.1
         @ngrx/effects: 14.3.1
         @ngrx/entity: 14.3.1
         @ngrx/router-store: 14.3.1
         @ngrx/store: 14.3.1
         @ngrx/schematics: 14.3.1
         @ngrx/store-devtools: 14.3.1
         ng-mocks: 14.2.1
@neilsoult
Copy link

I was just noticing this today as I was attempting to create a custom generator that would use the angular remote generator.

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 21, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants