Angular CLI用于在项目外部构建文件

问题描述 投票:0回答:2
..
 "apps": [
    {
      "outDir": "C:/dist",
      "root": "src",
..

我正在寻找一个选项,将我的角度5 +角度/ cli应用程序文件构建到一个完全独立的目录,而不是我的项目。可能吗。目前使用上面的设置(.angular-cli.json)我收到一个错误:

An asset cannot be written to a location outside the project.
angular angular-cli angular5
2个回答
2
投票

在package.json中使用npm脚本。

{
  "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",

npm run build-prod构建。 postbuild-prod中的任何内容都会在构建之后运行。

参考copyfiles,全球安装。


0
投票
"outDir": "./dist/target/resources",

在.angular-cli.json文件中编辑到上面

© www.soinside.com 2019 - 2024. All rights reserved.