-
Notifications
You must be signed in to change notification settings - Fork 642
Closed
Description
Hey 👋
Node 12+ supports esm modules, Node 10 end of life is in April which means we can stop using babel, bundlers, etc in node 🥳
Package maintainers are starting to publish new package versions with only esm modules support, e.g. sindresorhus with 1k+ packages is going this road (article).
It would be great to see esm module support in objection. Currently some imports/exports don't work:
// works
import { Model } from 'objection'`
console.log(Model)
// doesn't work - throws error
import { snakeCaseMappers } from 'objection'
// works - current workaround
import objection from 'objection'
console.log(objection.snakeCaseMappers)Produced error (node v15.12.0):
SyntaxError: Named export 'snakeCaseMappers' not found. The requested module 'objection' 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 'objection';
const { snakeCaseMappers } = pkg;Since 3.0 is coming with knex 0.95 support, maybe this can be also added in major release.
Thank you 🤗
DominicRoyStang and joziahg
Metadata
Metadata
Assignees
Labels
No labels