angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng build -prod prevents component from displaying if route has a resolver that uses Httpclient

Open dldavis opened this issue 8 years ago • 5 comments

Versions

<!--
Output from: `ng --version`.
If nothing, output from: `node --version` and `npm --version`.
  Windows (7/8/10). Linux (incl. distribution). macOS (El Capitan? Sierra?)
-->

Angular CLI: 1.7.0 Node: 6.9.1 OS: win32 x64 Angular: 5.2.5 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router

@angular/cli: 1.7.0 @angular-devkit/build-optimizer: 0.3.1 @angular-devkit/core: 0.3.1 @angular-devkit/schematics: 0.3.1 @ngtools/json-schema: 1.2.0 @ngtools/webpack: 1.10.0 @schematics/angular: 0.3.1 @schematics/package-update: 0.3.1 typescript: 2.7.1 webpack: 3.11.0

Repro steps

  • Step 1 Create a resolver that users a service that uses Httpclient
  • Step 2 Add a route that uses the resolver
  • Step 3 build using ng build -prod

Observed behavior

<!-- Normally this includes a stack trace and some more information. -->

There component selector does not appear below the router-outlet

Desired behavior

Mention any other details that might be useful (optional)

Everything works fine using ng build -dev. It only applies to the HTTPClient. The old HTTP module works fine. This is my first post to a git repository so please let me know if you need additional information.

dldavis avatar Feb 17 '18 20:02 dldavis

Looks like it's related to this issue

https://github.com/angular/angular-cli/issues/9495

dldavis avatar Feb 19 '18 16:02 dldavis

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.

filipesilva avatar Feb 20 '18 20:02 filipesilva

Here is a very simple example that shows the problem. If you switch the target to es5 it works.

https://github.com/dldavis/httpclient

This is my first time posting or contributing to a project, so I hope it helps.

dldavis avatar Feb 20 '18 22:02 dldavis

Closing a reproduction is no longer available.

If the problem persists, please open a new issue following our submission guidelines.

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.

alan-agius4 avatar Oct 10 '18 11:10 alan-agius4

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.