Skip to content

[Schematics] Module resolution does not work with dots in package name #17414

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

Closed
1 of 15 tasks
zartinn opened this issue Apr 7, 2020 · 3 comments
Closed
1 of 15 tasks

Comments

@zartinn
Copy link

zartinn commented Apr 7, 2020

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which the bug was not present with Angular CLI 8.2.2

Description & Minimal Reproduction

External schematics executed with

ng g @myorg/some.package

does not work in Angular 9 anymore.
The problem seem to be the module resolution with packages that have a dot in it.
Renaming the package without a dot to @myorg/some-package fixes the issue and the CLI executes correctly the schematic. But it would be nice if the module resolution will be working again with dots.

🔥 Exception or Error

[error] Error: Cannot find module '@myorg/some.package'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.resolve (internal/modules/cjs/helpers.js:33:19)
at NodeModulesEngineHost._resolveCollectionPath (/Users/zartin/ws/ang9/node_modules/@angular-devkit/schematics/tools/node-module-engine-host.js:36:38)
at NodeModulesEngineHost.createCollectionDescription (/Users/zartin/ws/ang9/node_modules/@angular-devkit/schematics/tools/file-system-engine-host-base.js:109:27)
at SchematicEngine._createCollectionDescription (/Users/zartin/ws/ang9/node_modules/@angular-devkit/schematics/src/engine/engine.js:147:40)
at SchematicEngine.createCollection (/Users/zartin/ws/ang9/node_modules/@angular-devkit/schematics/src/engine/engine.js:140:43)
at GenerateCommand.getCollection (/Users/zartin/ws/ang9/node_modules/@angular/cli/models/schematic-command.js:127:35)
at GenerateCommand.initialize (/Users/zartin/ws/ang9/node_modules/@angular/cli/models/schematic-command.js:43:37)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)

🌍 Your Environment

Angular CLI: 9.1.0
Node: 10.18.1
OS: darwin x64

Angular: 9.1.0
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router
Ivy Workspace: Yes

Package Version

@angular-devkit/architect 0.901.0
@angular-devkit/build-angular 0.901.0
@angular-devkit/build-optimizer 0.901.0
@angular-devkit/build-webpack 0.901.0
@angular-devkit/core 9.1.0
@angular-devkit/schematics 9.1.0
@angular/cdk 9.2.0
@angular/material 9.2.0
@ngtools/webpack 9.1.0
@schematics/angular 9.1.0
@schematics/update 0.901.0
rxjs 6.5.5
typescript 3.8.3
webpack 4.42.0

@BenjaminDobler
Copy link

There is a related issue which was already fixed here:
#17085

And the fix:
ea3d9e0#diff-8244badb0e200238f4c59331169e0b83

I found out that this also fixes this "." issue.
Is there any information when this will be released? Is there a chance for a fix release for 9 or are we more looking at v10?
Thank You

@alan-agius4
Copy link
Collaborator

Hi @BenjaminDobler, this should be released in the coming days and will be part of 9.1.1

Closing the issue as this is a duplicate of #17085 and is already addressed.

Thanks.

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators May 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants