Skip to content

Applying Typescript Transforms Before the @ngtools/webpack Loader #19328

@benwinding

Description

@benwinding

Goal

So I'm trying to apply a typescript transform to angular files BEFORE the webpack plugin AngularCompilerPlugin touches them.

Problems

  • It seems that the webpack loader @ngtools/webpack ignores all previous loaders (The @ngtools/webpack loader does not fully support loader chaining) as mentioned in this comment
  • It seems that the AngularCompilerPlugin directly touches the filesystem instead of using webpack's virtual filesystem as explained in this comment
  • It seems custom typescript transforms are not on the road map 😞 Support custom TypeScript transformers angular#22434 (comment)

Possible Solution

  • In a few blog posts and tutorials I've seen (like this one), it seems like I might be able to use the AngularCompilerPlugin's private api _transformers or _platformTransformers, but adding a transformer doesn't seem to transform the typescript BEFORE the AngularCompilerPlugin processes the typescript.

Does anyone have any suggestions? Is this even possible?

Lastly big thanks to all the contributors! 👍

Related Issues

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions