0

I'm using type module/import syntax for the rest of my project, but the Sequelize CLI generates files with require syntax. How should I handle this? I'm already having trouble with not being able to import a file that I renamed to .cjs so sequelize can run it as it uses the require syntax, and I'm sure there will be other issues

1
  • can you share your package.json file snippet here , what is type used there? Commented Apr 22 at 21:44

1 Answer 1

0

Try this Simple Solution Different File Types

  • Re-code files using import to end with the .mjs extension

  • Re-code files using require to end with the .cjs extension

  • Each will be handled correctly by Node.js itself.

Or Spend Time Updating Files You Already Have (If You Can Spur the Moment)

Update files generated by Sequelize from this: const Sequelize = require('sequelize'); to this import { Sequelize } from 'sequelize';

I hope my answer would help you

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.