Node 10 (using esm) error
See original GitHub issueindex.js
import { GraphQLNonNull, GraphQLList, GraphQLBoolean } from 'graphql'
import { GraphQLUpload } from 'apollo-upload-server'
import resolve from './resolver'
export default {
type: GraphQLBoolean,
args: {
files: {
type: new GraphQLList(new GraphQLNonNull(GraphQLUpload))
}
},
resolve
}
result
(node:20404) UnhandledPromiseRejectionWarning: file:///Users/macbook/WebstormProjects/project/node_modules/apollo-upload-server/lib/types.mjs:1
import { GraphQLScalarType } from 'graphql'
SyntaxError: Missing export name 'GraphQLScalarType' in ES module: file:///Users/macbook/WebstormProjects/project/node_modules/graphql/index.js
at file:///Users/macbook/WebstormProjects/project/node_modules/apollo-upload-server/lib/types.mjs:1
(node:20404) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
node.js - How would you fix an 'ERR_REQUIRE_ESM' error?
4 Answers 4 · 1)Use fix esm https://www.npmjs.com/package/fix-esm module & import the module like this: const someModule = require("fix-esm"). · 2 ...
Read more >Error when using ESM that works with ts-node #212 - GitHub
When I use import with ts-node, it works, but then when I run the same script with ts-node-dev, then I get this error...
Read more >Using ECMAScript modules (ESM) with Node.js
Learn about using ES modules in Node.js today and get a closer look at how you can migrate your codebase to make use...
Read more >What does it take to support Node.js ESM? – The Guild
js v10.x is dropped, everything should be fine and supporting ESM shouldn't be that hard. After working on migrating all The Guild libraries, ......
Read more >Error ERR REQUIRE ESM | Must use import to load ES Module
How to use ES Modules in Node. · Top 5 Excel Functions for Finance People ( with end-to-end example) · Require vs Import...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I’m going to guess this is a bug I noticed with babel 7 where destructuring imports is broken. To work around this, I believe we need to change our syntax to:
@qertis The issue is your
graphql
version (v0.10.1) needs to be at least v0.13.1. That is the first version to have proper ESM named exports, .mjs, etc.