After upgrading to Angular 21 ang trying to migrate to vitest - From 188985.

Hello,

After upgrading to Angular 21 ang trying to migrate to vitest, using this guide I am facing the same problem:

SyntaxError: Named export 'ArrayBase' not found. The requested module '@syncfusion/ej2-angular-base' is a CommonJS module, which may not support all module.exports as named exports.

CommonJS modules can always be imported via the default export, for example using:


import pkg from '@syncfusion/ej2-angular-base';

const { setValue, ComponentBase, ComponentMixins, FormBase, ComplexBase, Template, ArrayBase } = pkg;

Thank you.


3 Replies 1 reply marked as answer

JS Jeeva Selvarasu Syncfusion Team March 13, 2026 08:11 AM UTC

Hi Amalia Chrysanthakopoulou ,

Thank you for contacting Syncfusion Support regarding the issue with running unit tests for the Syncfusion module. The error you encountered indicates that the requested module '@syncfusion/ej2-angular-base' is a CommonJS module, which may not fully support named exports. 

This behavior occurs because Syncfusion packages are distributed as CommonJS (CJS) modules, and Vitest (in ESM mode) cannot resolve them as named exports by default. To address this, please update your vitest.config.ts with the following configuration:

server: {

      deps: {

        inline: [/@syncfusion\/.*/],

      },

    },


We trust this will resolve the issue. Should you have any further questions or require additional assistance, please do not hesitate to reach out.

Regards,

Jeeva S


Marked as answer

AC Amalia Chrysanthakopoulou March 13, 2026 08:57 AM UTC

Thank you, it works!



AJ Archana Jayakumar Syncfusion Team March 16, 2026 05:02 AM UTC

Hi Amalia,

You're welcome! please get back to us if you need further assistance. 

Regards,
Archana


Loader.
Up arrow icon