Skip to content
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

fix(@ngtools/webpack): don't show loader errors after compilation fails #7575

Merged
merged 1 commit into from
Sep 4, 2017

Conversation

filipesilva
Copy link
Contributor

When compilation fails, the loader can still return broken code. This generates extra stack traces that don't show any useful information and obscure the real error.

This PR cuts down on these extra errors.

Before:

kamik@T460p MINGW64 /d/sandbox/master-project (master)
$ ng build --aot --i18n-file src/locale/missing-file.xlf
Date: 2017-09-01T14:16:40.650Z
Hash: ceb93ba6373e5bbe16bb
Time: 3217ms
chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] [rendered]
chunk {main} main.bundle.js, main.bundle.js.map (main) 3.6 kB {vendor} [initial] [rendered]
chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 220 kB {inline} [initial] [rendered]
chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 11.8 kB {inline} [initial] [rendered]
chunk {vendor} vendor.bundle.js, vendor.bundle.js.map (vendor) 883 kB [initial] [rendered]

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in 'D:\sandbox\master-project\src'
resolve './$$_gendir/app/app.module.ngfactory' in 'D:\sandbox\master-project\src'
  using description file: D:\sandbox\master-project\package.json (relative path: ./src)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: D:\sandbox\master-project\package.json (relative path: ./src)
    using description file: D:\sandbox\master-project\package.json (relative path: ./src/$$_gendir/app/app.module.ngfactory)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        D:\sandbox\master-project\src\$$_gendir\app\app.module.ngfactory doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        D:\sandbox\master-project\src\$$_gendir\app\app.module.ngfactory.ts doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        D:\sandbox\master-project\src\$$_gendir\app\app.module.ngfactory.js doesn't exist
      as directory
        D:\sandbox\master-project\src\$$_gendir\app\app.module.ngfactory doesn't exist
[D:\sandbox\master-project\src\$$_gendir\app\app.module.ngfactory]
[D:\sandbox\master-project\src\$$_gendir\app\app.module.ngfactory.ts]
[D:\sandbox\master-project\src\$$_gendir\app\app.module.ngfactory.js]
[D:\sandbox\master-project\src\$$_gendir\app\app.module.ngfactory]
 @ ./src/main.ts 3:0-74
 @ multi ./src/main.ts
ERROR in Error: The translation file (src/locale/missing-file.xlf) locale must be provided. Use the --locale option.
    at Function.CodeGenerator.create (D:\work\cli\node_modules\@angular\compiler-cli\src\codegen.js:61:23)
    at Function.NgTools_InternalApi_NG_2.codeGen (D:\work\cli\node_modules\@angular\compiler-cli\src\ngtools_api.js:72:53)
    at _donePromise.Promise.resolve.then (D:\work\cli\packages\@ngtools\webpack\src\plugin.ts:381:44)

After:

kamik@T460p MINGW64 /d/sandbox/master-project (master)
$ ng build --aot --i18n-file src/locale/missing-file.xlf
Date: 2017-09-01T14:15:37.863Z
Hash: a7b64550c14d7f9d0d1b
Time: 1059ms
chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] [rendered]
chunk {main} main.bundle.js, main.bundle.js.map (main) 361 bytes [initial] [rendered]
chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 381 bytes {inline} [initial] [rendered]
chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 11.8 kB {inline} [initial] [rendered]

ERROR in Error: The translation file (src/locale/missing-file.xlf) locale must be provided. Use the --locale option.
    at Function.CodeGenerator.create (D:\work\cli\node_modules\@angular\compiler-cli\src\codegen.js:61:23)
    at Function.NgTools_InternalApi_NG_2.codeGen (D:\work\cli\node_modules\@angular\compiler-cli\src\ngtools_api.js:72:53)
    at _donePromise.Promise.resolve.then (D:\work\cli\packages\@ngtools\webpack\src\plugin.ts:386:44)

@filipesilva filipesilva merged commit 9872d43 into angular:master Sep 4, 2017
@filipesilva filipesilva deleted the fix-loader-errors branch September 4, 2017 08:49
dond2clouds pushed a commit to d2clouds/speedray-cli that referenced this pull request Apr 23, 2018
@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 Sep 12, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants