Skip to content

Allow ng serve to use a separate tsconfig.json #12000

@kiranjholla

Description

@kiranjholla

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Command (mark with an x)

- [ ] new
- [ ] build
- [x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

node --version:
v10.4.1

npm --version:
6.1.0

ng --version:
Angular CLI: 6.1.4
Node: 10.4.1
OS: win32 x64
Angular: 6.1.4
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.7.4
@angular-devkit/build-angular      0.7.4
@angular-devkit/build-ng-packagr   0.7.5
@angular-devkit/build-optimizer    0.7.4
@angular-devkit/build-webpack      0.7.4
@angular-devkit/core               0.7.4
@angular-devkit/schematics         0.7.4
@angular/cdk                       6.4.6
@angular/flex-layout               6.0.0-beta.17
@angular/material                  6.4.6
@ngtools/json-schema               1.1.0
@ngtools/webpack                   6.1.4
@schematics/angular                0.7.4
@schematics/update                 0.7.4
ng-packagr                         3.0.6
rxjs                               6.2.2
typescript                         2.7.2
webpack                            4.9.2

Repro steps

  • Create new Angular CLI Workspace ng new my-app --style scss --prefix map
  • Add a library to this workspace ng g library my-lib --style scss --prefix mlb
  • Update my-app code to import this library import { MyLib } from 'my-lib'
  • Build library ng build my-lib
  • Serve app ng serve
  • Feel happy with your achievement as everything works
  • Now, clean-up the ./dist folder and run ng serve again
  • Get error!

The log given by the failure

ERROR in projects/my-app/src/app/shell/my-app.module.ts(18,30): error TS2307: Cannot find module 'my-lib'.

Desired functionality

Allow adding a different tsconfig.json file for the ng serve command in angular.json. Currently the architect build options for @angular-devkit/build-angular:dev-server does not accept a tsConfig parameter as part of its options.

Having the ability to define a separate tsconfig file with compilerOptions setup with different paths array for the my-lib during the ng-serve process would help in faster development as the compiler could fetch the relevant source directly from the projects/my-lib directory instead of looking at the ./dist directory

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions