Skip to content
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

docs: add configuration to use knex with Next.js or Vite #6046

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

rafaelcitario
Copy link

Integrating Knex.js with Next.js or Vite

I've been trying to implement Knex in my applications using Next.js and Vite, but I keep encountering errors.
An old way to use Knex was with node --loader, but this was discontinued in Node 18.

I found a way to implement it using the Knexfile with the .js extension and adding a companion file that I called database.config.mjs.
It's very important to follow this extension configuration: Knexfile.js and database.config.mjs.

What I do in the documentation:

  • Installation and configuration methods for Knex.
  • Configuration methods for the Knexfile.js and database.config.mjs files.
  • Guidance for the user to add type: module in package.json.
  • Final line with the command for creating a migration example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant