Skip to content

Package subpath './src/builders/karma' is not defined by "exports" #30644

Closed

Description

@chihab

Command

test

Is this a regression?

  • Yes, this behavior used to work in the previous version

The previous version in which this bug was not present was

No response

Description

When trying to create a custom karma builder:

import { createBuilder } from "@angular-devkit/architect";
import {
  execute as executeKarmaBuilder,
  KarmaBuilderOptions,
} from "@angular/build/src/builders/karma";
export default createBuilder<KarmaBuilderOptions>(executeKarmaBuilder);

The builder compiles successfully but I get this issue when trying to run it with ng test:

An unhandled exception occurred: Package subpath './src/builders/karma' is not defined by "exports" in /.../node_modules/@angular/build/package.json

The builder's execute function is marked experimental so I guess we should be able to use it (at my own risk), no?

Image

Minimal Reproduction

Create a custom builder using the code above.

Exception or Error

An unhandled exception occurred: Package subpath './src/builders/karma' is not defined by "exports" in /.../node_modules/@angular/build/package.json

Your Environment

Angular CLI: 20.0.5
Node: 22.15.0
Package Manager: npm 10.9.2
OS: darwin arm64

Angular: 20.0.6
... common, compiler, compiler-cli, core, forms, localize
... platform-browser, platform-browser-dynamic, platform-server
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.2000.5
@angular-devkit/build-angular   20.0.5
@angular-devkit/core            20.0.5
@angular-devkit/schematics      20.0.5
@angular/build                  20.0.5
@angular/cli                    20.0.5
@angular/ssr                    20.0.5
@schematics/angular             20.0.5
rxjs                            7.8.2

Anything else relevant?

No response

Activity

  1. alan-agius4 commented on Jul 3, 2025

    @alan-agius4
    Collaborator

    It’s expected that that file cannot be imported directly as deep imports are not allowed.

    That said, these symbols should be imported
    from @angular/build however right not these are not exported.

  2. added
    freq1: low
    on Jul 3, 2025
  3. added theissue type on Jul 3, 2025
  4. chihab commented on Jul 3, 2025

    @chihab
    Author

    I suppose unit-test builder symbols should also be exported from @angular/build/index

  5. added 3 commits that reference this issue on Jul 3, 2025
    373b63e
    5c16bbd
    9d404a8
  6. added 2 commits that reference this issue on Jul 4, 2025
    d0bdf20
    8879716
  7. angular-automatic-lock-bot commented on Aug 4, 2025

    @angular-automatic-lock-bot

    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.

  8. locked and limited conversation to collaborators on Aug 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area: @angular/buildfreq1: lowseverity3: brokentype: bug/fix

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions