4

I got a new Angular 9 project and we share image files accross multiple apps with a Symlink (symbolic link) folder inside the /assets.

Turns out that when we build this folder is not added to the dist/assets

![enter image description here

even the --preserve-symlinks or setting in the angular.json file do not help.

ng build --preserve-symlinks

It used to work with Angular-8 but since the upgrade no longer.

Anyone had this issue?

1
  • when I explicitly list the symlink folder in the assets, it is copied over, but not if it is a subfolder. This looks to me like a bug. in the example above, I need to add "assets/fr" to the assets configuration Commented May 14, 2020 at 4:35

1 Answer 1

1

To anyone coming across this thread.

It seems like this issue has been resolved with Angular 10.

At least if you use junctions in Windows, the files inside the linked folder are copied to the assets folder by the CLI as expected. I did not use the --preserve-symlinks flag, as I think it's deprecated or removed, but I set preserveSymlinks to true in the anguler.json file at:

projects.[projName].architect.build.options.preserveSymlinks
Sign up to request clarification or add additional context in comments.

2 Comments

Fix does not work for me. If the symlink is for CSS from ./nod_modules, putting an "@import" into styles.scss seems to work for me. It no longer needs the symlink.
@MatthewB. Well with SCSS it is a different story because those files are compiled into css by a couple of packages (like sass, postcss, and whatnot). For static assets that angular has to copy to the build output, I think it might actually not work as well, but it works as soon as you reference the symlink explicitly in the assets array (not just the assets folder, but the symlinked folder inside).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.