Angular-cli: Module build failed (from ./node_modules/@ngtools/webpack/src/index.js)

Created on 11 Feb 2020  Β·  7Comments  Β·  Source: angular/angular-cli

🐞 bug report

Affected Package


The issue is caused by package @ngtools/webpack

Is this a regression?


No.

Description

A clear and concise description of the problem...
After updating angular version 8 to 9, when I try to execute the commands ionic serve orng serve I get the compilation error.

πŸ”₯ Exception or Error


[ng] ERROR in ./src/zone-flags.ts
[ng] Module build failed (from ./node_modules/@ngtools/webpack/src/index.js):
[ng] Error: /home/mejia97/Documentos/CTM/ctm-front/src/zone-flags.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
[ng]     at AngularCompilerPlugin.getCompiledFile (/home/mejia97/Documentos/CTM/ctm-front/node_modules/@ngtools/webpack/src/angular_compiler_plugin.js:909:23)
[ng]     at /home/mejia97/Documentos/CTM/ctm-front/node_modules/@ngtools/webpack/src/loader.js:41:31
[ng]     at runMicrotasks ()
[ng]     at processTicksAndRejections (internal/process/task_queues.js:97:5)

🌍 Your Environment

Angular Version:


     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / β–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 9.0.1
Node: 13.7.0
OS: linux x64

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

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.900.1
@angular-devkit/build-angular     0.900.1
@angular-devkit/build-optimizer   0.900.1
@angular-devkit/build-webpack     0.900.1
@angular-devkit/core              9.0.1
@angular-devkit/schematics        9.0.1
@angular/cli                      9.0.1
@angular/fire                     5.4.2
@ngtools/webpack                  9.0.1
@schematics/angular               8.1.3
@schematics/update                0.900.1
rxjs                              6.5.4
typescript                        3.7.5
webpack                           4.41.2

Anything else relevant?

more info

Most helpful comment

Seems like zone-flags.ts is not part of the compilation, is zone-flags another entrypoint? Most likely this file needs to be added in the files section of your tsconfig.app.json

Edit: most likely in polyfills.ts you have an import with an extension. Ex: import './zone-flags.ts'. Removing the extension should solve the issue.

All 7 comments

Seems like zone-flags.ts is not part of the compilation, is zone-flags another entrypoint? Most likely this file needs to be added in the files section of your tsconfig.app.json

Edit: most likely in polyfills.ts you have an import with an extension. Ex: import './zone-flags.ts'. Removing the extension should solve the issue.

Yes, this was the problem, thanks for your valuable help. He had never had such inconvenience.

Can you post the snippet that fixed this please? I've tried a million paths and it still fails every time.

Ah ok, through the power of "embarrassing myself publicly", I almost immediately figured this out.

Note to others: read the instructions - its src/tsconfig.app.json not the tsconfig.json in the root of the project.

@rtpHarry, I actually update the comment, as the root cause seems to be an import with a .ts extension.

Ah yeah, you're right. I just switched out my solution for yours and it also fixed it; in a cleaner way. Thanks.

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

Related issues

hareeshav picture hareeshav  Β·  3Comments

MateenKadwaikar picture MateenKadwaikar  Β·  3Comments

brtnshrdr picture brtnshrdr  Β·  3Comments

NCC1701M picture NCC1701M  Β·  3Comments

purushottamjha picture purushottamjha  Β·  3Comments