Skip to content
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

enable declarationMap in workspace libraries #17888

Closed
2 of 15 tasks
xiaoxiangmoe opened this issue Jun 9, 2020 · 8 comments · Fixed by #17920
Closed
2 of 15 tasks

enable declarationMap in workspace libraries #17888

xiaoxiangmoe opened this issue Jun 9, 2020 · 8 comments · Fixed by #17920
Labels
area: schematics/angular feature Issue that requests a new feature
Milestone

Comments

@xiaoxiangmoe
Copy link

xiaoxiangmoe commented Jun 9, 2020

🚀 Feature request

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Description

see https://www.typescriptlang.org/v2/tsconfig#declarationMap

You should strongly consider turning this on if you’re using project references.

ng generate library my-lib will add path mapping in tsconfig.json. So we should enable declarationMap

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jun 9, 2020

Duplicate of ng-packagr/ng-packagr#1464

@alan-agius4 alan-agius4 marked this as a duplicate of ng-packagr/ng-packagr#1464 Jun 9, 2020
@alan-agius4 alan-agius4 marked this as not a duplicate of ng-packagr/ng-packagr#1464 Jun 9, 2020
@alan-agius4
Copy link
Collaborator

Actually let's re-open this, since it's slightly different but block it on ng-packagr/ng-packagr#1464

@alan-agius4 alan-agius4 reopened this Jun 9, 2020
@ngbot ngbot bot modified the milestone: Backlog Jun 9, 2020
@alan-agius4 alan-agius4 added the needs: investigation Requires some digging to determine if action is needed label Jun 9, 2020
@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jun 9, 2020

Also, this needs some digging to see if it's even useful since we don't use project references.

@xiaoxiangmoe
Copy link
Author

I included these files in my npm package:

  • ts source code
  • compiled js code
  • .d.ts file
  • map files of js and .d.ts

When I use this npm library, I can jump directly to the ts source code by VSCode Go to Definition, which is very convenient.

@xiaoxiangmoe
Copy link
Author

Also, should we use Project References in angular?

@alan-agius4
Copy link
Collaborator

alan-agius4 commented Jun 9, 2020

should we use Project References in angular?

No, the Angular CLI / Compiler don't support composite projects.

I do see, that they can be useful in a monorepo, however, when shipping a library I don't think that dts maps will add any value unless you also ship the typescript source files.

@alan-agius4 alan-agius4 added needs: discussion On the agenda for team meeting to determine next steps and removed needs: investigation Requires some digging to determine if action is needed state: blocked on upstream labels Jun 11, 2020
@alan-agius4 alan-agius4 changed the title enable declarationMap in ng-packagr enable declarationMap in workspace libraries Jun 11, 2020
@alan-agius4 alan-agius4 self-assigned this Jun 11, 2020
@alan-agius4 alan-agius4 removed the needs: discussion On the agenda for team meeting to determine next steps label Jun 11, 2020
@alan-agius4
Copy link
Collaborator

We had a chat around this yesterday and we decided that we should enable declarationMap for non production builds.

@alan-agius4 alan-agius4 removed their assignment Jun 12, 2020
alan-agius4 added a commit that referenced this issue Jun 12, 2020
…ilds

With this change we enable emitting declaration maps when building libraries to be consumed locally as this improved DX as this will allow editors to go to the original typescript file when using `Go to Definition`.

For production builds, declaration maps are disabled because they are not useful since the source files are not included in the distributable package.

Closes #17888
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Jul 14, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: schematics/angular feature Issue that requests a new feature
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants