Skip to content

Absolute path usedin --deploy-url caused warning #8847

Closed

Description

@feng-xiao

Versions

Angular CLI: 1.6.0
Node: 8.9.1
OS: win32 x64
Angular: 5.1.0
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker

@angular/cli: 1.6.0
@angular/platform-server: error
@angular/tsc-wrapped: error
@angular-devkit/build-optimizer: 0.0.35
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.41
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.0
@schematics/angular: 0.1.10
@schematics/schematics: 0.0.10
typescript: 2.5.3
webpack: 3.10.0

Repro steps

Observed behavior

WARNING --deploy-url and/or --base-href contain unsupported values for ng serve.  Default serve path of '/' used. Use --serve-path to override.

Desired behavior

No warning, and the value should be supported

Mention any other details that might be useful (optional)

Activity

  1. clydin commented on Dec 12, 2017

    @clydin
    Member

    That warning is intentional. The dev server is served using the --host and --port options specified. The dev server path cannot be an absolute path as it is combined with the host and port options to create the full address. As such it defaults to serving from the root of the configured host and port when it cannot calculate the serving path using the deploy URL and base HREF supplied.

    Also, for the example path shown above, setting the port to 32323 would allow the application to be accessed from http://localhost:32323/.

  2. feng-xiao commented on Dec 12, 2017

    @feng-xiao
    Author

    @clydin Does --host and --port set the concatenated value to webpack_require.p variable?

  3. clydin commented on Dec 12, 2017

    @clydin
    Member

    --host, --port, and --serve-path are dev server only settings and have no effect on the built output.

  4. feng-xiao commented on Dec 12, 2017

    @feng-xiao
    Author

    @clydin That's why I need to set absolute path on --deploy-url. I came out a solution to integrate Angular CLI project into ASP.NET MVC. In ng serve mode, the application is hosted in IIS Express (assume the port number is 4201), and it's rendering index.html content. I need to also emit scripts and styles that are hosted in dev server (assume port number is 4200) to make automatic build works. Without setting webpack's public path variable, I will get errors as the Angular/Angular CLI think the scripts are hosted in 4201.

    I know Angular CLI is hiding many complexities of Webpack, --deploy-url is only parameter I found that can change webpack public path (__webpack_require.p), I don't know why you don't like absolute path set to this parameter

  5. clydin commented on Dec 12, 2017

    @clydin
    Member

    If IIS is the client facing server then for development it should be configured to forward the necessary requests to the CLI's dev server. Assuming the application would then be hosted on IIS in some form in production, this would then mimic the production environment.

    Also, note that the deploy URL and/or base HREF settings are actually used to generate the application. The dev server just cannot use them to serve the application as explained above.

  6. feng-xiao commented on Dec 12, 2017

    @feng-xiao
    Author

    The setting is only for ng serve and hmr mode. I just use dev server to do browser reloading and serving on-the-fly build output. It would be much appreciated if you can support absolute path or shed light for me how to host angular app in ASP.NET MVC and support ng serve

  7. clydin commented on Dec 12, 2017

    @clydin
    Member

    To clarify, are you saying it doesn't work when using deploy URL or that you don't want to see the warning?

  8. feng-xiao commented on Dec 12, 2017

    @feng-xiao
    Author

    It's working so far. I just don't want to see the warning, and I hope the absolute value won't break other stuff.

  9. angular-automatic-lock-bot commented on Sep 7, 2019

    @angular-automatic-lock-bot

    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.

  10. locked and limited conversation to collaborators on Sep 7, 2019
  11. removed their assignment
    on Jun 28, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions