ardatan / ardatan/graphql-tools
Can't import the named export XXXX from non EcmaScript module (only default export is available)
- Dominant language
- TypeScript
- Stars
- 5.4k
- Forks
- 830
- Avg merge
- 10h 59m
- Merged PRs (30d)
- 45
Description
**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](https://stackoverflow.com/a/70859159/13510870).
Can Anyone provide a proper fix to this?
TIA :smile:
Contributor guide
Research direction
Reproduce the compile failure using the listed Ubuntu, NodeJS, Craco, react-scripts, and React versions, then inspect the import reported in node_modules/@graphql-tools/load/index.mjs. Trace the use of AggregateError and the @graphql-tools/load entry point. Done means the example builds without the named-export error in the stated environment.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- graphql, nodejs, react, typescript
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100