- Home
- Forum
- React - EJ 2
- Import of import { Query } from '@syncfusion/ej2-data' in nodejs backend
Import of import { Query } from '@syncfusion/ej2-data' in nodejs backend
Hi
I'm trying to implement the GraphQL resolver for DataManager query in my nodejs backend. I get the following exception when I try to import something from @syncfusion/ej2-data
SyntaxError: The requested module '@syncfusion/ej2-data' does not provide an export named 'Query'
at ModuleJob._instantiate (node:internal/modules/esm/module_job:220:21)
at async ModuleJob.run (node:internal/modules/esm/module_job:321:5)
at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:644:26)
at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:117:5)
Node.js v22.17.0
@syncfusion/ej2-data: 30.1.40
My ts.config is as follows:
I tried to add allowSyntheticDefaultImports but it didn't help.
What am I missing here?
Thank's in advance
Hi,
Greetings from Syncfusion Support.
By reviewing your query, it seems you are facing issue in importing the Query from the @syncfusion/ej2-data. We tried to replicate the issue by preparing a sample with GraphQL in react platfrom, we cannot replicate the issue from our end. We have attached the sample for your reference.
Try using the below approach to import the Query.
|
import * as Data from '@syncfusion/ej2-data'; const { Query, DataManager, ODataAdaptor } = Data;
|
If
you still face issue, please replicate the issue in the provide sample which
will help us to validate this further.
Regards,
Dineshnarasimman M
Attachment: ReactGraphQL_cae1905a.zip
Hey,
I ran into a similar issue before with @syncfusion/ej2-data and @mr flip and Node.js ESM imports. The error basically means that the package doesn’t have a named export called Query in the way you’re trying to import it.
A few things to check:
-
Sometimes these packages export a default object or use CommonJS exports, which don’t always play nicely with ESM
import { }syntax. Try importing the whole module as a default import and then accessingQueryfrom it, like:
import SyncfusionData from '@syncfusion/ej2-data';
const { Query } = SyncfusionData;
-
Double-check the version you’re using and see if the package actually exports
Queryas a named export. You can try logging the imported module to see its properties. -
Your
tsconfig.jsonlooks mostly fine for ESM, but sometimes switching"module"to"ESNext"or"CommonJS"can affect how imports resolve. -
Also, ensure your Node.js version fully supports the
nodenextmodule resolution and ESM.
If none of this works, you might try using require temporarily or looking for any open issues in Syncfusion’s repo related to ESM support.
Hope this helps! Let us know if you find a workaround.
- 2 Replies
- 3 Participants
-
DI Dietl,Christian
- Jul 30, 2025 03:14 PM UTC
- Nov 20, 2025 10:07 AM UTC