Angular-cli: @ngtools/webpack build failing after update from 1.9.8 to 1.10.1

Created on 26 Feb 2018  路  8Comments  路  Source: angular/angular-cli

Versions

ngtools/webpack 1.10.1
webpack 3.11.0
node 9.6.1
macOS 10.13

Repro steps

Building webpack project (not using @angular/cli, only @ngtools/webpack) in AOT

Observed behavior

ERROR in ./src/app/desktop/app.module.desktop.ngfactory.js
Module not found: Error: Can't resolve '/Users/lukaszsamson/myapp/src/node_modules/@angular/animations' in '/Users/lukaszsamson/myapp/src/app/desktop'
 @ ./src/app/desktop/app.module.desktop.ngfactory.js 64:10-40
 @ ./src/main.browser.desktop.ts
 @ multi (webpack)-dev-server/client?http://0.0.0.0:3000 ./src/main.browser.desktop.ts

ERROR in ./src/app/desktop/app.module.desktop.ngfactory.js
Module not found: Error: Can't resolve '/Users/lukaszsamson/myapp/src/node_modules/@angular/animations/browser' in '/Users/lukaszsamson/myapp/src/app/desktop'
 @ ./src/app/desktop/app.module.desktop.ngfactory.js 33:10-48
 @ ./src/main.browser.desktop.ts
 @ multi (webpack)-dev-server/client?http://0.0.0.0:3000 ./src/main.browser.desktop.ts

ERROR in ./node_modules/ngx-dropdown/index.js
Module not found: Error: Can't resolve '/Users/lukaszsamson/myapp/src/node_modules/@angular/common' in '/Users/lukaszsamson/myapp/node_modules/ngx-dropdown'
 @ ./node_modules/ngx-dropdown/index.js 12:15-41
 @ ./src/app/desktop/app.module.desktop.ngfactory.js
 @ ./src/main.browser.desktop.ts
 @ multi (webpack)-dev-server/client?http://0.0.0.0:3000 ./src/main.browser.desktop.ts
...

Every module resolution fails.

Desired behavior

clean build as on 1.6.8

repro steps

Most helpful comment

To reproduce this issue

  1. clone angular-starter repo
  2. yarn
  3. npm start
    on v 1.10.0 compiles succesfully
  4. update @ngtools/webpack to 1.10.1
  5. yarn
  6. npm start
    on v 1.10.1 compile fails

gdi2290/angular-starter#1971

All 8 comments

This seems like a bug but we'll need to look at a reproduction to find and fix the problem. Can you setup a minimal repro please?

You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

To reproduce this issue

  1. clone angular-starter repo
  2. yarn
  3. npm start
    on v 1.10.0 compiles succesfully
  4. update @ngtools/webpack to 1.10.1
  5. yarn
  6. npm start
    on v 1.10.1 compile fails

gdi2290/angular-starter#1971

@filipesilva ping

9727 looks similar to this issue

It seems to be related to paths that look like:
import { SomethingService } from 'app/core/something.service.ts'; (Will break)

import { SomethingService } from '../core/something.service.ts'; (Will NOT break)

Downgrading @ngtools/webpack to 1.9.x for now.
Edit: Might be related to https://github.com/angular/angular-cli/commit/5dee617

This issue seems to be linked to "paths" in tsconfig.json

{
  // ...
  "compilerOptions": {
    "paths": {
      "@angular/*": ["node_modules/@angular/*"]
    }
  }

  // ...
}

And as mentioned by @larssn it is linked to version > 1.9.x

Thanks for reporting this issue. This issue is now obsolete due to changes in the recent releases. Please update to the most recent Angular CLI version.

If the problem persists after upgrading, please open a new issue, provide a simple repository reproducing the problem, and describe the difference between the expected and current behavior.

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._

Was this page helpful?
0 / 5 - 0 ratings