Skip to content

Performance on large projects / exclude files from plugin #196

@FelixMalfait

Description

@FelixMalfait

Hello, thanks for Lingui!

We have a large NestJS project (~5,000 source files) but only ~100 files use Lingui macros on the server side (msg, t from @lingui/core/macro). The @lingui/swc-plugin is configured globally in our .swcrc, so it processes all 5,000 files on every build — even though ~4,900 of them have no Lingui imports at all.

The per-file overhead seem to add up significantly and impact performance
Would it be possible for the plugin to short-circuit early when a file contains no Lingui imports if that's not the case? Maybe an early exit before doing a full AST traversal (if that's what you do), it would make the no-op case near-instant and dramatically improve build times for large codebases where only a small fraction of files use Lingui.
Alternatively, is there a way to configure SWC to apply the plugin only to specific files/directories?

Thanks a lot

Félix

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions