graphql-tools
graphql-tools copied to clipboard
Can't import the named export XXXX from non EcmaScript module (only default export is available)
Describe the bug Can't import the named export XXXX from non EcmaScript module (only default export is available)(https://stackoverflow.com/questions/69343038/cant-import-the-named-export-xxxx-from-non-ecmascript-module-only-default-expo)
Expected behaviour Run without errors
Environment:
- OS: Ubuntu 20.04
@graphql-tools/: "8.2.0"- "@graphql-tools/mock": "8.5.1",
- NodeJS:c14.17.0
- Craco: 6.4.3
- react-scripts: "4.0.3",
- React : 17.0.2
My Code
import { makeExecutableSchema } from '@graphql-tools/schema'
import { loadSchemaSync } from '@graphql-tools/load'
import { GraphQLFileLoader } from '@graphql-tools/graphql-file-loader'
import casual from 'casual'
const typeDefs = loadSchemaSync('./schema.graphql', {
loaders: [new GraphQLFileLoader()]
})
const schemaWithMocks = makeExecutableSchema({
typeDefs
})
export default schemaWithMocks
The Error I got is
Failed to compile.
./node_modules/@graphql-tools/load/index.mjs
Can't import the named export 'AggregateError' from non EcmaScript module (only default export is available)
Additional context I got it worked as by following this solution. Can Anyone provide a proper fix to this? TIA :smile:
I think This seems an issue with the bundler with .mjs extensions.
I think This seems an issue with the bundler with
.mjsextensions. hi @ardatan, Tq for the quick response. I really appreciate it. Can you point me to where can I find the solution? It would really help me.