- Notifications
You must be signed in to change notification settings - Fork 41
Closed
Description
Node.js ESM is not supported; please support it.
In demo.mjs
:
import { createComplexityRule, simpleEstimator, } from 'graphql-query-complexity';
Then run node demo.mjs
:
file://[redacted]/demo.mjs:3 simpleEstimator, ^^^^^^^^^^^^^^^ SyntaxError: Named export 'simpleEstimator' not found. The requested module 'graphql-query-complexity' 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 'graphql-query-complexity'; at ModuleJob._instantiate (internal/modules/esm/module_job.js:97:21) at async ModuleJob.run (internal/modules/esm/module_job.js:142:20) at async Loader.import (internal/modules/esm/loader.js:182:24) at async Object.loadESM (internal/process/esm_loader.js:68:5)
Ideally don't publish CJS at all, to avoid the dual package hazard.
Please make sure that the modules can all be deep imported without having to go through the index; that way we can avoid the JavaScript runtime parsing and loading into memory stuff our program doesn't use. E.g:
import createComplexityRule from 'graphql-query-complexity/createComplexityRule.mjs'; import simpleEstimator from 'graphql-query-complexity/simpleEstimator.mjs';
dburles, sachaw and ArtemSkok-Leia
Metadata
Metadata
Assignees
Labels
No labels