Skip to content

Referring a typescript file outside of project directory is not working #5217

@sugarg

Description

@sugarg

OS: Windows 10
angular-cli version: 1.0.0-rc.0
Node version: 6.9.5
Npm version: 3.10.10

Following is my directory structure:

├── MainProject
│   ├── package.json
│   ├── .angular.cli.json
│   ├── src (folder)
├── Shared
│   ├── package.json
│   ├── Service
│   │   ├── Service.ts

My angular-cli project is in MainProject directory. In MainProject, I am trying to refer Shared/Service/Service.ts file (file is outside of MainProject folder). Service.ts file has import { Injectable, Injector } from "@angular/core"; and import { Router } from "@angular/router"; in it. I was getting @angular/core and @angule/router not found error while compiling therefore I included package.json in Shared folder which has reference to these packages and did npm install in Shared directory. Developer build of MainProject is working fine but prod build is giving following error. Please if someone can help in resolving it.

ERROR in Error encountered resolving symbol values statically. Calling function 'makeDecorator', function calls are not supported. Consider replacing the function or lambda with a reference to an exported function, resolving symbol Injectable in C:/Apps/Shared/node_modules/@angular/core/src/di/metadata.d.ts, resolving symbol OpaqueToken in C:/Apps/Shared/node_modules/@angular/core/src/di/opaque_token.d.ts, resolving symbol OpaqueToken in C:/Apps/Shared/node_modules/@angular/core/src/di/opaque_token.d.ts

ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/modules/uci.app.module.ngfactory' in 'C:\Apps\MainProject\src'
 @ ./src/main.ts 4:0-85
 @ multi ./src/main.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions