Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Cannot find name '$localize' when using vitest without explicit import #32232

Open
@PawelKawula

Description

Is this a bug report or a feature request?

  • Bug Report
  • Feature Request

Please provide the steps to reproduce the issue [Bug Report only]

  1. Run ng new vitest-test
  2. Run ng add @angular/localize
  3. Change signal in app.html to use $localize

Please provide the expected behavior vs the actual behavior you encountered [Bug Report only]

I expected succesful run
Instead it only succeeds when i add import '@angular/localize' to app.ts, I can't do it using setupFiles option.
I suspect that it's because it cant pick up this automatic import when it builds and so i can do it only in app.ts, but i dont have to repeat this import for other components.
Adding vitest configuration with globals option enabled doesn't help either.

Please provide a screenshot if possible [Bug Report only]

No response

Please provide the exception or error you saw [Bug Report only]

######/vitest-test>ng test
Automatically searching for and using Vitest configuration file.
Application bundle generation failed. [0.533 seconds] - 2026年01月06日T19:48:08.764Z
✘ [ERROR] TS2304: Cannot find name '$localize'. [plugin angular-compiler]
 src/app/app.ts:11:36:
 11 │ protected readonly title = signal($localize`vitest-test`);
 ╵ ~~~~~~~~~
Watch mode enabled. Watching for file changes...

Is this a browser-specific issue? If so, please specify the device, browser, and version. [Bug Report only]

It's vitest related

Description [Feature Request only]

No response

Proposed solution [Feature Request only]

No response

Alternatives considered [Feature Request only]

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Milestone

    No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

        AltStyle によって変換されたページ (->オリジナル) /