Build fails when using symbolic link folder in Windows
Versions
Angular CLI: 1.7.1 Node: 8.9.4 OS: win32 x64 Angular: 5.2.6 ... animations, common, compiler, compiler-cli, core, forms ... http, language-service, platform-browser ... platform-browser-dynamic, router
@angular/cli: 1.7.1 @angular-devkit/build-optimizer: 0.3.2 @angular-devkit/core: 0.3.2 @angular-devkit/schematics: 0.3.2 @ngtools/json-schema: 1.2.0 @ngtools/webpack: 1.10.1 @schematics/angular: 0.3.2 @schematics/package-update: 0.3.2 typescript: 2.5.3 webpack: 3.11.0
Repro steps
Create symbolic link to folder where you will work: mklink /d C:\myshortpath C:\some\really\deep\folder\Idontwant\to\type cd C:\myshortpath C:\myshortpath> ng new mycoolapp C:\myshortpath> ng serve
Observed behavior
ERROR in c:/some/really/deep/folder/Idontwant/to/type/mycoolapp/src/main.ts
Module build failed: Error: c:\some\really\deep\folder\Idontwant\to\type\mycoolapp\src\main.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
at AngularCompilerPlugin.getCompiledFile (c:\some\really\deep\folder\Idontwant\to\type\mycoolapp\node_modules@ngtools\webpack\src\angular_compiler_plugin.js:674:23)
at plugin.done.then (c:\some\really\deep\folder\Idontwant\to\type\mycoolapp\node_modules@ngtools\webpack\src\loader.js:467:39)
at
webpack: Failed to compile.
Desired behavior
No error
Mention any other details that might be useful (optional)
Kind of an edge case, not sure it is really a priority to fix, but wanted it at least documented for the next poor soul who gets stuck on it.
For people stumbling onto this Try adding this to your angular-cli.json file
"build": {
"preserveSymlinks": true
},
like this:
"defaults": { "build": { "preserveSymlinks": true }, "styleExt": "scss", "component": { } }
This worked for me on my test apps...and hopefully for you too
This has been moved under build >> options as of angular 5?/6+
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"preserveSymlinks": true,
Closing as fixed per the comment above.
This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.