Angular CLI assets folder not going into dist folder

therightdoctors picture therightdoctors · Sep 29, 2018 · Viewed 10.9k times · Source

We have an Angular 6 universal application. My application suddenly started giving an error. Actually assets folder is not going into dist after production build. It was working properly, but suddenly assets folder is not copied into dist folder .

Please help what may be the case ?

Answer

billyjov picture billyjov · Sep 30, 2018

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

First i will i have an updated project using angular cli 6.x.x. Then Adjust your assets paths into your angular.json like this:

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

Then make sure you never try to copy a file outside the project output path.

Second method
If you really want to use the glob method from node glob, i think you will need make sure it's installed like in the documentation explained.

You can take a look in the official documentation of assets angular cli