Skip to content

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

@lucboutier

Description

@lucboutier

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions