-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
schemaInspector is not a function #59
Comments
What is this file we're looking at? Is this bundled using typescript/another tool? Is this Node native ESM? The schema inspector package exports as commonJS currently |
Native ESM: node --version v14.17.0
I'm kind of dumb about it, I don't know if I answer your question correctly. |
|
Schema inspector is still built to CJS and using import * as schemaInspector from 'knex-schema-inspector'; and if that doesn't work, try import { default as schemaInspector } from 'knex-schema-inspector'; This big Node-wide shift from CJS to ESM is really exciting, but also a little confusing 😅 |
To anyone wondering what's wrong you need to import it as import { default as schemaInspectorImport } from "knex-schema-inspector";
const schemaInspector = schemaInspectorImport.default;
// Export inspector with knex instance from Objection's model
export const inspector = schemaInspector(Model.knex()); |
Version 1.5.7 show me : schemaInspector is not a function.
The select works fine. But the schemaInpsector didn´t work. What´s wrong?
The text was updated successfully, but these errors were encountered: