Description
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.
ERROR in ../actual-common/modules/auth0/logout/logout.component.ts
Module build failed: TypeError: Cannot read property 'text' of undefined
at Object.getTokenPosOfNode (/home/Angular/frontend/node_modules/typescript/lib/typescript.js:6768:71)
at IdentifierObject.TokenOrIdentifierObject.getStart (/home/Angular/frontend/node_modules/typescript/lib/typescript.js:80500:23)
at IdentifierObject.TokenOrIdentifierObject.getText (/home/Angular/frontend/node_modules/typescript/lib/typescript.js:80521:77)
at refactor.findAstNodes.filter (/home/Angular/frontend/node_modules/@ngtools/webpack/src/loader.js:139:44)
at Array.filter (native)
at refactor.findAstNodes.forEach.node (/home/Angular/frontend/node_modules/@ngtools/webpack/src/loader.js:138:14)
at Array.forEach (native)
at _removeDecorators (/home/Angular/frontend/node_modules/@ngtools/webpack/src/loader.js:129:10)
at Promise.resolve.then (/home/Angular/frontend/node_modules/@ngtools/webpack/src/loader.js:292:33)
@ ./src/$$_gendir/app/app.module.ngfactory.ts 81:0-79
@ ./src/main.ts
@ multi ./src/main.ts
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?)