Angular CLI Assets 文件夹不会进入 dist 文件夹

标签 angular angular-cli-v6

我们有一个 Angular 6 通用应用程序。我的应用程序突然开始出错。实际上 Assets 文件夹在生产构建后不会进入 dist。它工作正常,但突然没有将 assets 文件夹复制到 dist 文件夹中。

请帮忙看看是什么情况?

最佳答案

You use the assets array inside the build target in angular.json to list files or folders you want to copy as-is when building your project. if you think you need to exclude files, consider not putting that thing in the assets

首先,我将使用 angular cli 6.x.x 更新项目。然后将您的 Assets 路径调整到您的 angular.json 中,如下所示:

"assets": [
    "src/favicon.ico",
    "src/assets",
    "src/manifest.json",
    "src/ngsw-worker-mod.js",
    "src/sitemap.xml",
    "src/robots.txt",
    "src/sitemap_video.xml"
],

然后确保您永远不会尝试复制项目输出路径之外的文件。

第二种方法
如果你真的想使用 node glob 中的 glob 方法,我认为您需要确保它已按照说明的文档中的方式安装。

你可以看看official documentation of assets angular cli

关于Angular CLI Assets 文件夹不会进入 dist 文件夹,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52569779/

相关文章:

javascript - 如何在 Angular 6+ 中正确使用第三方 javascript 库

javascript - 使用 Angular 从 API 访问数据(格式错误?)

angular - 指定的模块不存在 Angular 6

angular - 应用管道后如何在 ngFor 中查找项目数

Angular2 测试服务——未定义的服务

javascript - Angular 6 中具有相应组件的子路由

javascript - Angular 2 外部库错误

angular - NativeScript RadListView rootLocator 不是一个函数

node.js - RouterLink 在 Angular 6 中不起作用

angular - 使用 --watch 依次运行两个 Angular CLI 任务