How to resolve the ESM require problem, I have tried a lot to resolve it but I was unable to fix this out.
Asked
Active
Viewed 65 times
0
-
A few sentences are usually not enough to show others what you experienced. If you cannot easily describe the details, attach some screen shots. BTW, I removed the monodevelop tag as it does not seem to be relevant. – Lex Li Jul 05 '22 at 19:29
1 Answers
0
https://www.npmjs.com/package/chalk#install
IMPORTANT: Chalk 5 is ESM. If you want to use Chalk with TypeScript or a build tool, you will probably want to use Chalk 4 for now. Read more.
For chalk 5 and above you'll need import statement:
import chalk from 'chalk';
Otherwise, use chalk 4 with require statement:
const chalk = require('chalk');

lmao
- 1