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

deploy-url does not change path of scripts with ng serve

Open lucboutier opened this issue 8 years ago • 3 comments

Bug Report or Feature Request (mark with an x)

- [x ] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [x ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

node --version v8.9.4 npm --version 5.6.0 ng --version

 _                      _                 ____ _     ___
/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ △ \ | '_ \ / | | | | |/ _ | '__| | | | | | | / ___ | | | | (| | || | | (| | | | || | | | // __| ||_, |_,||_,|| _||| |___/

Angular CLI: 6.1.2 Node: 8.9.4 OS: darwin x64 Angular: 6.0.6 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router

Package Version

@angular-devkit/architect 0.6.8 @angular-devkit/build-angular 0.6.8 @angular-devkit/build-optimizer 0.6.8 @angular-devkit/core 0.3.2 @angular-devkit/schematics 0.7.2 @angular/cdk 6.3.0 @angular/cli 6.1.2 @angular/material 6.3.0 @ngtools/webpack 6.0.8 @schematics/angular 0.7.2 @schematics/update 0.7.2 rxjs 6.2.1 typescript 2.7.2 webpack 4.12.0

macOS High Sierra

Repro steps

ng serve --deploy-url /

<script type="text/javascript" src="runtime.js"></script>

I would have expected to see

<script type="text/javascript" src="/runtime.js"></script>

Mention any other details that might be useful

I am using currently the base tag that was working fine for me until I included some SVG clip-mask that reference definitions using the url(#def-id) which is the way to go using SVG but does not work well with base url definitions.

I was thinking that I could solve this using the APP_BASE_HREF variable but then I ran in an issue when using live reload for dev purpose, the url that I edit is often something different than the root and so relative script urls like <script type="text/javascript" src="runtime.js"></script> just causes not found issues.

I found that deploy-url could be used to change the scripts url, which worked fine using ng build, but failed using ng serve. deploy-url is however documented for the ng serve command, I am not sure what it does in this context.

Thanks for your help.

lucboutier avatar Aug 20 '18 15:08 lucboutier

@filipesilva when can it be fixed? we need to send --deploy-url value from command line to override the settings in angular.json.

feng-xiao avatar Sep 17 '18 13:09 feng-xiao

Sorry if this isnt related. But, if it is, there is a workaround at the bottom.

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

jtal avatar Sep 19 '18 20:09 jtal

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.