-
Notifications
You must be signed in to change notification settings - Fork 12k
ng build --prod unable to process symbolic links #5098
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
+1 |
As @kipy-be says, symbolic links work with "ng serve", plus "ng lint" and even "ng build" just as long as you do not use the --prod flag. Both "ng build --prod" and "ng serve --prod" cause the error. |
+1 |
Getting this too, on Windows though. It looks like when I run If I run the command inside the actual directory, the parents are correctly set. EDIT: After more debugging, program.getSourceFile(fileName) is coming back undefined when inside the symlink directory. So the typescript compiler's currentDirectory is the symlink location, but the paths getting passed into getSourceFile are resolved paths(so the actual location on disk), which I guess is throwing the typescript compiler out of whack, so it's just returning undefined. |
I've noticed that AOT is now enabled by default with the So, both are working with symlink resolution. The issue is aot related. |
I concur with @kipy-be, I am able to compile with symbolic links when I set --aot false. To be honest, I have no idea what I lose by turning AOT off. Is it a practical workaround to the symbolic link problem, or should I stick to my cloning with the actual files? |
@MortimerCat You would want to use AOT in a production environment. It compiles your html/css files into the internal angular components. If you skip this step, it ends up happening in the browser which will increase page load time. |
Sounds like a bug. Thanks for reporting it. |
Same issue on latest tooling. |
I'm getting a similar issue on Windows 7 which appears related to routing, but I'm not using symlinks. But I get the error only in IE11, not Chrome. I'm using all the recommended IE polyfills from I was trying to create a repro but haven't narrowed it down to something small yet. Again, only get the error with
|
A way to look for the problematic code: Find the Node primitive (fs.whatever) for resolving symlinks - this is the thing we don't want CLI or anything it calls, to use. Add a "throw" there. Look at stack trace. Use that to find wherever in CLI it gets called. Then work through how CLI calls libraries to avoid this happening. |
I also use a symlink on a "imgs" folder that is located inside "src" folder and referenced in "angular-cli.json" The This is pretty blocking at that moment. |
@djtahl Sound likes the Assets not working after update issue. Try the following
|
@MortimerCat thank you for your answer, unfortunately I tested this command
And nothing changed. |
Having the same issue here, build --prod works in local, but breaks in development server. I will test the with aot --false and I will give some feedback. |
I was having a similar issue with accessing third party libraries, disabling aot resolved this issue and the prod build was a similar size to that that is was when using aot. |
I am now on version @angular/cli@1.2.1 and my original problem seems to have been resolved. Not sure when and why - I just happened to notice that I have been doing the production compiles with my symbolic links in place. |
Further to my previous comment, it would appear that we now have a --preserve-symlinks flag available in "ng build" #6460 This cured my symbolic link problem with vscode debugging - all my symbolic link problems have been solved, as far as I am concerned this is a closed issue. |
We have made a few changes to how we process symlinks, and think this issue was fixed in one of them. Closing then. |
Hi, |
My ng server command in full is as follows.
You need to make sure you are running an up to date version of the CLI or at least @angular/cli@1.2.1 which is the version that originally worked for me. |
According to the source file of the serve command (here) there is no |
Its handled within the build command (here) . I am not an expert in the details of how ng serve works, but I always assumed ng serve calls ng build and would pass the parameters across? |
|
So, Angular + symlink issues add up as following?
|
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
OS?
Linux Ubuntu
Versions.
@angular/cli: 1.0.0-rc.0
node: 7.4.0
os: linux x64
I am working on two angular-cli projects (frontend and backend). As they share many components, services etc, I created a folder "actual-common" and put a symbolic link "common" under the src folder of each project. This worked well until I performed an ng build using the --prod option, at which point every shared item gives the following message.
I noted that the error refers to my absolute path "actual-common", so I presume it is a webpack issue similar to webpack/webpack#1643 I also note that a custom webpack configuration is not available using Angular-Cli, so the workaround described on the issue is not available to me.
My workaround was to clone the project and replace the "common" symlink with the actual files.
(Is there a better way to share code between local projects?)
The text was updated successfully, but these errors were encountered: