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

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

Closed
feng-xiao opened this issue Dec 12, 2017 · 9 comments · Fixed by #8882
Closed

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

feng-xiao opened this issue Dec 12, 2017 · 9 comments · Fixed by #8882

Comments

@feng-xiao
Copy link

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)

@clydin
Copy link
Member

clydin commented Dec 12, 2017

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/.

@feng-xiao
Copy link
Author

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

@clydin
Copy link
Member

clydin commented Dec 12, 2017

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

@feng-xiao
Copy link
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

@clydin
Copy link
Member

clydin commented Dec 12, 2017

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.

@feng-xiao
Copy link
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

@clydin
Copy link
Member

clydin commented Dec 12, 2017

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

@feng-xiao
Copy link
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.

@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 7, 2019
@clydin clydin removed their assignment Jun 28, 2022
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 a pull request may close this issue.

2 participants