question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error in Could not resolve app module with @ngtools/webpack 1.3.1

See original GitHub issue

Bug Report or Feature Request (mark with an x)

  • bug report -> Similar to issue #4637, now closed, but for latest ngtools
  • feature request

Versions.

  • Output from: ng --version. ng is not installed in this project. @ngtools/webpack is.
  • output from: node --version: v6.2.2
  • npm --version: 3.9.5
  • OS: Windows 10 version 1703, as well as Mac OS Sierra
  • angular 4.1.3,
  • @ngtools/webpack 1.3.1,
  • webpack 2.5.1,
  • typescript 2.3.2.

Repro steps.

There’s a mini sample project showing the issue.

  1. Clone repository https://github.com/BrainCrumbz/ngtools-webpack-demo and change dir
  2. npm i
  3. npm run build-prod

The log given by the failure.

[...redacted...]
 [378] ./~/tslib/tslib.es6.js 8.02 kB {1} [built]
       [] -> factory:652ms building:2489ms = 3141ms
 [379] ./~/zone.js/dist/zone.min.js 29.8 kB {1} [built]
       [] -> factory:2333ms building:2441ms dependencies:616ms = 5390ms
    + 369 hidden modules

ERROR in Could not resolve "src/app/module" from "src/app/module".
Child src\shared\view\not-found.component.html:
       [0] ./src/shared/view/not-found.component.html 376 bytes {0} [built]
            factory:132ms building:31ms = 163ms
Child src\private\view\component.html:
       [0] ./src/private/view/component.html 291 bytes {0} [built]
            factory:116ms building:38ms = 154ms
[...redacted...]

Desired functionality.

Build should complete successfully.

Mention any other details that might be useful.

The app has a lazily loaded module (dubbed private). You can build it in development as well (npm run build-dev), serve it from another shell (npm run serve) and browse to localhost:3000. The readme in repository root shows all npm commands.

The AOT build is not using full angular-cli, just @ngtools/webpack.

I tried fiddling with angularCompilerOptions.genDir value in AOT tsconfig, with no luck. That just changed the error message, for example it changed the path as Could not resolve “./src/app/module” from “./src/app/module”., but no real clue about it.

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:1
  • Comments:10 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
hanslcommented, May 25, 2017

@mradcliffe that error has been fixed by 1.0.6. This is a different error.

@GiuseppePiscopo we’re going to investigate.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 7, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

I am trying to npm install ngtools/webpack@1.3.3 Module ...
It is a bug in angular universal using ng-seed i have install package "enhanced-resolve": "3.3.0" in package.json. its working fine for me.
Read more >
New Section - Angular Components and Core Directives
I'm getting the following. ERROR in ./src/polyfills.ts. Module not found: Error: Can't resolve '@angular/localize/init'.
Read more >
Emit attempted before Angular Webpack plugin ...
This appears to be an issue with Typescript version >4.9.0. I haven't worked out what that is yet, but a possible workaround is...
Read more >
angular/angular-cli - Gitter
I am using ngtools/webpack, but I can't get the AoT bundle to work. It seems to complete the bundling but my bundle only...
Read more >
Angular
Thanks in advance. ./src/main.ts - Error: Module build failed (from ./node_modules/@ngtools/webpack/src/ivy ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found