Skip to content

[vitest] require() of ES Module @angular/core/fesm2022/core.mjs not supported #9376 #10511

Closed
@andreialecu

Description

@andreialecu

Is there an existing issue for this?

How do you use Sentry?

Sentry Saas (sentry.io)

Which SDK are you using?

@sentry/angular

SDK Version

7.99.0

Framework Version

No response

Link to Sentry event

No response

SDK Setup

No response

Steps to Reproduce

Repro at:
https://stackblitz.com/edit/vitest-dev-vitest-b9tqx7?file=package.json,test%2Fbasic.test.ts%3AL3

Expected Result

No error.

Actual Result

I'm attempting to migrate a test suite to vitest as per: https://analogjs.org/docs/features/testing/vitest#manual-installation and @sentry/angular seems to prevent this because as soon as it is imported, Vite will complain about:

Error: require() of ES Module@angular/core/fesm2015/core.mjs not supported.
Instead change the require of @angular/core/fesm2015/core.mjs to a dynamic import() which is available in all CommonJS modules.

This was reported previously here: #9376 but in a different context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Package: angularIssues related to the Sentry Angular SDK

    Type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions