Skip to content

Assets not correctly adjusting with deploy-url parameter on the build #9835

Closed
@ignaciolarranaga

Description

@ignaciolarranaga

Versions

Angular CLI: 1.7.2
Node: 9.4.0
OS: darwin x64
Angular: 5.2.7
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.7.2
@angular-devkit/build-optimizer: 0.3.2
@angular-devkit/core: 0.3.2
@angular-devkit/schematics: 0.3.2
@ngtools/json-schema: 1.2.0
@ngtools/webpack: 1.10.1
@schematics/angular: 0.3.2
@schematics/package-update: 0.3.2
typescript: 2.5.3
webpack: 3.11.0

Repro steps

  • Create an empty project ng new example and install the dependencies npm install.
  • Add on sample images to assets (whatever image) cp sample.png src/assets and modify app.components.html adding the image:
...
<h2>Here are some links to help you start: </h2>
<img src="/assets/sample.png">
<ul>
...
  • Build the application changing the path to '/y' ng build --deploy-url=/y --base-href=/y -op=/tmp/y
  • Start a server on tmp folder (e.g. http-server -p 4200 /tmp)
  • Now open the browser and you will see the problem

Repo with the code for easier reproduction: https://github.com/ignaciolarranaga/9835-issue

Observed behavior

The img src is not prepended with /y as expected (or the folder you want to):
error example

Desired behavior

The image src to be prepended with the /y:

<img _ngcontent-c0="" src="/y/assets/sample.png">

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions