【问题标题】:Angular CLI to build files outside projectAngular CLI 在项目外部构建文件
【发布时间】:2017-12-20 14:52:38
【问题描述】:
..
 "apps": [
    {
      "outDir": "C:/dist",
      "root": "src",
..

我正在寻找一个选项来将我的 angular 5 + angular/cli 应用程序文件构建到与我的项目完全不同的目录中。可能吗。目前使用上面的设置(.angular-cli.json)我得到一个错误:

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

【问题讨论】:

标签: angular angular-cli angular5


【解决方案1】:

在 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,全局安装。

【讨论】:

    【解决方案2】:
    "outDir": "./dist/target/resources",
    

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

    【讨论】:

      猜你喜欢
      • 2018-08-29
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-02-24
      • 2019-08-07
      • 2018-05-19
      相关资源
      最近更新 更多