Skip to content

Secondary entry-point package.json files in APF require mainFields resolution (in Vitest) #45326

@Jordan-Hall

Description

@Jordan-Hall

Which @angular/* package(s) are the source of the bug?

core, router, Don't known / other

Is this a regression?

No - but not sure

Description

I'm trying to get unit test working with vite test. I've ran into an issue when importing testing modules

Error: Failed to resolve entry for package "@angular/core/testing". The package may have incorrect main/module/exports specified in its package.json: Failed to resolve entry for package "@angular/core/testing". The package may have incorrect main/module/exports specified in its package.json.

This also applies to the router module.

Please provide a link to a minimal reproduction of the bug

https://github.com/Jordan-Hall/vite-angular-template

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in (run ng version)

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/


Angular CLI: 13.1.4
Node: 16.13.0
Package Manager: npm 8.4.0
OS: win32 x64

Angular: 13.1.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1301.4
@angular-devkit/build-angular   13.1.4
@angular-devkit/core            13.1.4
@angular-devkit/schematics      13.1.4
@angular/cli                    13.1.4
@schematics/angular             13.1.4
rxjs                            7.4.0
typescript                      4.3.5

Anything else?

This projects uses NX and prototype of an angular cite plugin.

Metadata

Metadata

Assignees

Labels

area: packagingIssues related to Angular's creation of npm packagesneeds reproductionThis issue needs a reproduction in order for the team to investigate further

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions