v6: Improve support for ESM & CJS config files
See original GitHub issueWe currently search for config/config.json
and config/config.js
We should also automatically look for extensions .cjs, and .mjs so specifying the config file location is not necessary.
We should do the same for .sequelizerc
(https://github.com/sequelize/cli/blob/main/src/core/yargs.js#L7): load it using importHelper
and support files: .sequelizerc
(as js), .sequelizerc.js
, .sequelizerc.cjs
, .sequelizerc.mjs
, .sequelizerc.json
.
Issue Analytics
- State:
- Created 2 years ago
- Comments:6 (5 by maintainers)
Top Results From Across the Web
Bud v6.0.0 released - Roots Discourse
Upgrade guide · Keep your config file the same and use the .cjs extension · Update your config file to use ESM syntax...
Read more >Publish ESM and CJS in a single package - Anthony Fu
A short tutorial of shipping both ESM and CJS dual formats in a single NPM package.
Read more >StrykerJS v6.0: Expeditious Superior Mutations
From v6 onward, StrykerJS also supports your config as ESM. Either by adding { "type": "module" } to your package.json file, or by...
Read more >How to transpile ES modules with webpack and Node.js
We have covered other ways — for example, using the .mjs or .cjs file formats and how these extensions are resolved as either...
Read more >Gotchas - Remix
In our example here, we create a new file at utils/fs-extra.server.js : ... With major deployment platforms now supporting ESM server side, we're...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Similarly to https://github.com/sequelize/cli/issues/960, we could detect the module type in package.json, and provide a
--module cjs|esm
option, and generate the right contents accordinglyThis PR https://github.com/sequelize/cli/pull/987 includes docs update which says
ESM configuration files are supported for Node versions that support ESM natively, either via passing `--config config/config.mjs`, or by setting the `type` to `module` in your `package.json`.
In a project using
"type": "module",
, newly generated migration files are still non ESM:generates