angular / angular-cli

CLI tool for Angular
https://cli.angular.dev
MIT License
26.78k stars 11.98k forks source link

Angular app with the latest angular-cli tries to get assets (fonts and images) from the parent directory of the component instead of looking for them in the root directory #10386

Closed Praefectus-praetorio closed 6 years ago

Praefectus-praetorio commented 6 years ago

Angular app with the latest angular-cli gets assets (fonts and images) from the parent directory of the component. However as far as I understand from the configuration it should refer to the root path of the application. image The version and the angular.json file contents you may find below.

Versions

angular-cli 6.0.0-rc.5
@angular/compiler-cli@5.2.5
typescript 2.9.0-dev.20180414
node.js 8.11.1

Repro steps

Part of the angular.json file:

"$schema": "./node_modules/@angular-devkit/core/src/workspace/workspace-schema.json",
  "version": 1,
  "newProjectRoot": "projects",
  "projects": {
    "abp-zero-template": {
      "root": "",
      "projectType": "application",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist",
            "index": "src/index.html",
            "main": "src/main.ts",
            "tsConfig": "src/tsconfig.json",
            "polyfills": "src/polyfills.ts",
            "assets": [
              {
                "glob": "**/*",
                "input": "src/assets",
                "output": "/assets"
              },
              {
                "glob": "favicon.ico",
                "input": "src",
                "output": "/"
              },
              {
                "glob": "abp.signalr.js",
                "input": "node_modules/abp-web-resources/Abp/Framework/scripts/libs",
                "output": "/assets/abp"
              },
              {
                "glob": "**.*",
                "input": "node_modules/bootstrap-select/dist/js/i18n",
                "output": "/assets/localization/bootstrap-select"
              },
              {
                "glob": "**.*",
                "input": "node_modules/timeago/locales",
                "output": "/assets/localization/jquery-timeago"
              }
            ]...

Observed behavior

Error 404 not found.

Desired behavior

As far as I understand the app should always look for the fonts and images using root path like: http://domain.name/font.wff

instead of

http://domain.name/app/parent-folder-of-the-component-which-uses-this-font/font.wff.

Otherwise I will be forced to have dozens of assets duplicates across the app.

Just rolled back to angular-cli 1.7.4 and everything works fine.

clydin commented 6 years ago

Duplicate of #10378

Jrubzjeknf commented 6 years ago

Are you certain this has been resolved? I'm running into the same issue using angular cli version 6.0.0-rc.9.

Edit: upgrading to Angular 6.0.0 seems to have resolved this issue.

angular-automatic-lock-bot[bot] commented 5 years ago

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.