Skip to content

Module resolution is broken when wildcard path exists #10376

Closed
@jonrimmer

Description

@jonrimmer

Versions

    _                      _                 ____ _     ___
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
    
Angular CLI: 1.7.4
Node: 9.9.0
OS: darwin x64
Angular: 5.2.10
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Repro steps

Add the following to tsconfig.json:

  1. Create a new CLI project:

ng new angular-cli-is-broken

  1. Add a wildcard path mapping to the tsconfig:
"paths": {
  "*": ["./src/app/*"]
}
  1. Build the project:
npm run build

Observed behavior

Resolution of modules does not work:

ERROR in ./src/app/app.module.ngfactory.js
Module not found: Error: Can't resolve '/Users/jon/GitHub/angular-cli-is-broken/src/src/app/@angular/common' in '/Users/jon/GitHub/angular-cli-is-broken/src/app'

Etc.

Desired behavior

It should resolve modules correctly, as it did in 1.6.

Mention any other details that might be useful (optional)

This worked perfectly in 1.6. You can confirm this by regressing the CLI version in package.json to 1.6, and confirming that ng build now works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions