Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`sequelize init` writes JSON content into `.js` config file when using `.sequelizerc`

Open Beginner friendly
#1,566 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
68/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
javascript
Domain
cli, tooling

Research direction

Reproduce the issue with a .sequelizerc that points config to config/config.js, then run npx sequelize-cli init. Inspect the sequelize init path that generates the config file and compare its output with the dynamic configuration example in the linked documentation. Done means a .js config contains valid JavaScript and supports the documented dynamic configuration use case.

Written by the indexing model from the issue text.

Description

Issue Creation Checklist

  • I understand that my issue will be automatically closed if I don't fill in the requested information
  • I have read the contribution guidelines

Bug Description

When using sequelize init with a .js config file path (via .sequelizerc),
the generated config file contains raw JSON content instead of valid JavaScript.
This breaks the dynamic configuration use case documented in the official docs.

Reproducible Example
  1. Create a .sequelizerc file:
const path = require('path');
module.exports = {
  config: path.resolve('config', 'config.js'),
};
  1. Run:
npx sequelize-cli init
What do you expect to happen?

config/config.js should be generated with valid JS content:

module.exports = {
  development: {
    username: 'root',
    password: null,
    database: 'database_development',
    host: '127.0.0.1',
    dialect: 'mysql'
  }
}
What is actually happening?

config/config.js is created but filled with raw JSON content:

{
  "development": {
    "username": "root",
    "password": null,
    "database": "database_development",
    "host": "127.0.0.1",
    "dialect": "mysql"
  }
}

A .js file containing JSON is invalid as a dynamic configuration file and
breaks the use case documented here:
https://sequelize.org/docs/v6/other-topics/migrations/#dynamic-configuration

Environment
  • Sequelize-cli version: 6.6.5
  • Node.js version: 20.19.4
  • If TypeScript related: N/A
  • Database & Version: N/A
  • Connector library & Version: N/A

Would you be willing to resolve this issue by submitting a Pull Request?

  • Yes, I have the time and I know how to start.
Dominant language
JavaScript
Stars
2.6k
Forks
524
PR merge metrics
No merged PRs in 30d

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from sequelize/cli

All issues in sequelize/cli

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.