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

Partially-compiled multi-entry Ivy library missing in vendor sourcemaps #21271

Closed
2 of 15 tasks
Wintermoose opened this issue Jul 2, 2021 · 2 comments · Fixed by #21284
Closed
2 of 15 tasks

Partially-compiled multi-entry Ivy library missing in vendor sourcemaps #21271

Wintermoose opened this issue Jul 2, 2021 · 2 comments · Fixed by #21284

Comments

@Wintermoose
Copy link

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

I don't know, we've moved directly from Angular 10 (with libraries published in ViewEngine build) to Angular 12

Description

We have a rather big library with multiple entry points (package.json/ng-packagr definition per module, built and published as one library). We have application with vendor sourcemaps enabled. In the vendor sourcemaps, none of our modules with any components are included. Modules containing only services or directives are included. This is true for both our usual applications, and simple minimal app generated .

Other situations:

  • library compiled in full mode: source maps included
  • vendor maps disabled: source map pointing to js files included (as expected)
  • 3rd party libraries published in ViewEngine version: source maps included
  • published vs npm linked library: identical behaviour
  • aot true/false: identical behaviour

So it seems the source maps are somehow lost the moment angular does the local (in-app) compilation of the library components' templates.

When tested with minimal library generated by ng cli, this actually works correctly, so it is caused by something in our setup (or dependencies), but at this point I am unable to figure out what (I've matched tsconfig/angular.json settings as well as I could).

I did inspect the source maps generated in the library and as far as I can tell, they're correct (paths pointing to the correct folders etc)

🔬 Minimal Reproduction

As the library is big and not public, it's not easy for me to provide reproduction. I will try to see if I can duplicate the issue by expanding the sample library; but at this point I would appreciate pointers that would help us to identify the problem. I am willing to debug the compilation pipeline, if there is an obvious starting point.

🌍 Your Environment


Angular CLI: 12.1.0
Node: 12.18.2
Package Manager: npm 6.14.11
OS: win32 x64

Angular: 12.1.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1201.0
@angular-devkit/build-angular   12.1.0
@angular-devkit/core            12.1.0
@angular-devkit/schematics      12.1.0
@angular/cli                    12.1.0
@schematics/angular             12.1.0
ng-packagr                      12.1.0
rxjs                            6.6.7
typescript                      4.3.5

Anything else relevant?

No

@alan-agius4
Copy link
Collaborator

From ng-packagr/ng-packagr#2017

Type of Issue

[X] Bug Report
[ ] Feature Request

Description

I'm a bit unsure if this is really a bug with ng-packagr, but any help would be really appreciated. Whenever I try to use templateUrl in an angular library that is being built by ng-packagr, I loose my sourcemaps in devtools.

How To Reproduce

_A bug: I created a github repo which you can find here: https://github.com/Norby125/LibExportTest2
Repro steps: clone repo, npm install, build my-lib, use npm link on the outcome of the build, start the application

Expected Behaviour

Regardless I'm using templateUrl or template, source maps should not be broken.

Version Information

$ node_modules/.bin/ng-packagr --version
ng-packagr: 12.1.0
@angular/*: 12.1.0
typescript: 4.3.2
rxjs: 6.6.0
node: 14.17.0
npm/yarn: 6.14.13

@ngbot ngbot bot modified the milestone: Backlog Jul 5, 2021
alan-agius4 added a commit that referenced this issue Jul 5, 2021
…ourcemapping via builder sourcemap options"

This reverts commit d4c5f85.

Following a debugging and investigation with @petebacondarwin it appears that when the external template handling in the linker generates Babel AST nodes that reference the external template files which breaks Babel when it tried to flatten final source-map, which ends up no emitting any source-maps.

As an interim solution we should revert this.

Closes #21271
alan-agius4 added a commit that referenced this issue Jul 6, 2021
…on to false.

This is an interim solution until angular/angular#42769 is fixed.

Closes #21271
alan-agius4 added a commit that referenced this issue Jul 6, 2021
…on to false.

This is an interim solution until angular/angular#42769 is fixed.

Closes #21271
clydin pushed a commit that referenced this issue Jul 6, 2021
…ourcemapping via builder sourcemap options"

This reverts commit d4c5f85.

Following a debugging and investigation with @petebacondarwin it appears that when the external template handling in the linker generates Babel AST nodes that reference the external template files which breaks Babel when it tried to flatten final source-map, which ends up no emitting any source-maps.

As an interim solution we should revert this.

Closes #21271
clydin pushed a commit that referenced this issue Jul 6, 2021
…on to false.

This is an interim solution until angular/angular#42769 is fixed.

Closes #21271
clydin pushed a commit that referenced this issue Jul 6, 2021
…ourcemapping via builder sourcemap options"

This reverts commit d4c5f85.

Following a debugging and investigation with @petebacondarwin it appears that when the external template handling in the linker generates Babel AST nodes that reference the external template files which breaks Babel when it tried to flatten final source-map, which ends up no emitting any source-maps.

As an interim solution we should revert this.

Closes #21271

(cherry picked from commit 32050ca)
clydin pushed a commit that referenced this issue Jul 6, 2021
…on to false.

This is an interim solution until angular/angular#42769 is fixed.

Closes #21271

(cherry picked from commit 0776370)
@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 Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.