Skip to content

application builder: require() of ES Module @angular/core/fesm2022/core.mjs not supported #26135

Closed as not planned
@zip-fa

Description

@zip-fa

Command

serve

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

17.0.0-next.9

Description

Hi. I couldn't start dev server after upgrading from next.9 to rc.1.

This package triggers error:

"@sentry/angular-ivy": "^7.50.0",

Updating to latest version didn't help.

Import which leads to error:

import { createErrorHandler, TraceService } from '@sentry/angular-ivy';
{
      provide: ErrorHandler,
      useValue: createErrorHandler({
        showDialog: false,
        logErrors: !environment.production
      })
    },

Minimal Reproduction

ng serve/nx serve

Exception or Error

with ng serve:

[vite] Error when evaluating SSR module /chunk-WEHZQJTE.mjs: failed to import "@sentry/angular-ivy"
|- Error [ERR_REQUIRE_ESM]: require() of ES Module /node_modules/@angular/core/fesm2022/core.mjs not supported.
Instead change the require of /node_modules/@angular/core/fesm2022/core.mjs to a dynamic import() which is available in all CommonJS modules.
    at /node_modules/@sentry/angular-ivy/bundles/sentry-angular-ivy.umd.js:2:113
    at Object.<anonymous> (/node_modules/@sentry/angular-ivy/bundles/sentry-angular-ivy.umd.js:5:3)

with nx serve:

[vite] Internal server error: require() of ES Module /node_modules/@angular/core/fesm2022/core.mjs not supported.
Instead change the require of /node_modules/@angular/core/fesm2022/core.mjs to a dynamic import() which is available in all CommonJS modules.
      at Module.require (/node_modules/nx/src/adapter/compat.js:34:40)
      at /node_modules/@sentry/angular-ivy/bundles/sentry-angular-ivy.umd.js:2:113
      at Object.<anonymous> (/node_modules/@sentry/angular-ivy/bundles/sentry-angular-ivy.umd.js:5:3)

Your Environment

Angular CLI: 17.0.0-rc.1
Node: 18.18.2
Package Manager: npm 9.8.1
OS: darwin arm64

Angular: 17.0.0-rc.1
... animations, cli, common, compiler, compiler-cli, core, forms
... localize, platform-browser, platform-browser-dynamic
... platform-server, router, service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1700.0-rc.1
@angular-devkit/build-angular   17.0.0-rc.1
@angular-devkit/core            17.0.0-rc.1
@angular-devkit/schematics      17.0.0-rc.1
@angular/cdk                    17.0.0-next.6
@angular/material               17.0.0-rc.0
@angular/ssr                    17.0.0-next.9
@schematics/angular             16.2.5
rxjs                            7.8.1
typescript                      5.2.2
zone.js                         0.14.0

Anything else relevant?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions