question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

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

See original GitHub issue

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.

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
devversioncommented, Apr 22, 2022

Closing as this is not an issue with Angular. I provided a workaround, and the issue is now mitigated with the upcoming v14

0reactions
angular-automatic-lock-bot[bot]commented, May 23, 2022

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Creating Secondary Entry Points for your Angular Library
To make secondary entry points, we need to tell ng-packagr which folder to look for. This can be achieved by creating another package.json...
Read more >
How to use the 'main' parameter in package.json?
From the npm documentation: The main field is a module ID that is the primary entry point to your program. That is, if...
Read more >
ng-packagr - npm
All you have to do is create a package.json file and put it where you want a secondary entry point to be created....
Read more >
@rollup/plugin-node-resolve - NPM Package Overview - Socket
This plugin supports the package entrypoints feature from node js, specified in the exports or imports field of a package. Check the official ......
Read more >
Angular Package Format
This document describes the Angular Package Format (APF). ... Secondary entrypoints can be resolved via the "exports" field of the package.json for the ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found