question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to process @angular packages with the linker without @angular/cli

See original GitHub issue

Which @angular/* package(s) are relevant/releated to the feature request?

compiler-cli

Description

Before 13.0.0.-next.10 it was possible to execute ngcc and let it process the @angular/* packages to get ivy output in full compilation mode.

With the current release, 13.0.0-next.11, the exeuction of ngcc does not process the @angular/* packages. Therefore, these packages remain in partially compilated outputs and can’t be used directly in the browser.

Running ngcc: image

Browser error: image

Imports packages: image

Proposed solution

It would be great to have some sort of tooling / option to process the @angular/* packages with the linker without having to use the @angular/cli.

Alternatives considered

One alternative would be to also publish the @angular/* packages in fully compilated mode.

cheers flash ⚡

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:12 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
petebacondarwincommented, Oct 5, 2021

@flash-me - I just realised, given your low bundler tooling approach, that you should be aware that the new Angular Package Format (APF) for v13 will default to ES2020, which is not compatible out-of-the-box with Zone.js if the library uses the async await syntax.

There are a couple of options:

  • only use libraries that do not use async - await functions.
  • apply a transform (e.g. Babel 😱 ) to downlevel the ES2020 to ES2015 (or at least downlevel the async-await syntaxes).
  • configure your import-maps to point at the special FESM2015 export in the new format. (Is that possible?)

EDIT: sorry I made a mistake - the default is still ES2015 (see @angular/core@next):

"module": "./fesm2015/core.mjs",

So this should not be a problem.

1reaction
flash-mecommented, Oct 5, 2021

Conceivably, you could build your own AST manipulation library and then implement the AstHost interface, allowing you to completely drop Babel (and TypeScript) from the transformation. But do you really want to have to maintain that?

TBH: Probably not 😄 It’s just the step away from just using ngcc to introducing another dependency to get things work. But since my approach is not the casual use case of the majority, I’m aware that I might have to solve some stuff on my own.

But as I said, the use of @babel/cli is acceptable for me.

cheers flash ⚡

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating libraries - Angular
The Angular linker Babel plugin supports build caching, meaning that libraries only need to be processed by the linker a single time, regardless...
Read more >
The Angular linker (goodbye ngcc!) - Ninja Squad
You can easily create a library using the Angular CLI. Start by generating a new project with the option that disables the creation...
Read more >
A complete guide to Angular libraries - Will Taylor Blog
2 ) Alternatively, include your fonts and images in an assets folder within the library. As the `ng-packagr` build process will not copy...
Read more >
Complete beginner guide to publishing an Angular library to ...
1. Write Library in Angular that is compatible with npm format. · Step 2: Now we will add a library to the angular...
Read more >
Error: Cannot find module '@angular/compiler-cli/linker'
tsconfig, main.ts, package.json, Dockerfile ... haven't been changed for quite a while now so I'm clueless why this is suddenly no ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found