mkasepuu
mkasepuu

Reputation: 243

Angular CLI to build files outside project

..
 "apps": [
    {
      "outDir": "C:/dist",
      "root": "src",
..

I am looking for an option to build my angular 5 + angular/cli app files to a completely separate directory than my project is. Is it possible. Currently with the setup above (.angular-cli.json) I get an error:

An asset cannot be written to a location outside the project.

Upvotes: 1

Views: 3327

Answers (2)

nobjta_9x_tq
nobjta_9x_tq

Reputation: 1241

"outDir": "./dist/target/resources",

Edit in .angular-cli.json file to above

Upvotes: 0

Richard Matsen
Richard Matsen

Reputation: 23533

Use npm scripts in package.json.

{
  "name": "myApp",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    ...
    "build-prod": "ng build --prod --stats-json",
    "postbuild-prod": "copyfiles ./dist/**/* c:/dist",
  },
  "private": true,
  "dependencies": {
    "@angular-redux/store": "^6.4.2-beta.1",

Build with npm run build-prod. Anything in postbuild-prod gets run after the build.

Ref copyfiles, install globally.

Upvotes: 3

Related Questions