Skip to content

Can't run ng serve when I want an asset to be written to a location outside the project. #8652

Closed
@Dani2kn

Description

@Dani2kn

Versions

Angular CLI: 1.5.4
Node: 8.9.1
OS: win32 x64
Angular: 5.0.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.5.4
@angular-devkit/build-optimizer: 0.0.33
@angular-devkit/core: 0.0.21
@angular-devkit/schematics: 0.0.37
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.4
@schematics/angular: 0.1.7
typescript: 2.4.2
webpack: 3.8.1

Repro steps

  • Step 1 - in the project folder run command ng new angular-src
  • Step 2 - modify the .angular-cli.json
"apps": [
    {
      "root": "src",
      "outDir": "../public",

and

  "assets": [
        {
          "glob": "**/*",
          "input": "./assets/",
          "output": "../public",
          "allowOutsideOutDir": true
        },
        {
          "glob": "favicon.ico",
          "input": "./",
          "output": "../public",
          "allowOutsideOutDir": true
        }

  • Step 3 - run ng serve

Observed behavior

D:\Programare\NodeJS\MeanAuthApp\angular-src>ng serve
An asset cannot be written to a location outside the project.

Desired behavior

I want to be able to run ng serve with the location outDir: "../public"

Mention any other details that might be useful (optional)

I want to achieve the same output presented in the beginning of this tutorial linked below. And hope this will help! Many thanks!

https://www.youtube.com/watch?v=zrViDpWiNVE&list=PLillGF-RfqbZMNtaOXJQiDebNXjVapWPZ&index=5

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions