From 9494c7f1a19493207dca24124d736fcd03dbbcfe Mon Sep 17 00:00:00 2001 From: mambuco Date: Sun, 3 Sep 2023 00:07:21 +0200 Subject: [PATCH] Added Troubleshooting section --- readme.md | 26 +++++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/readme.md b/readme.md index ec32bff..6dd9b6d 100644 --- a/readme.md +++ b/readme.md @@ -1,4 +1,4 @@ -# COUT +# node-cout This package allows you to use `cout` and debug levels in Node.js. @@ -17,13 +17,13 @@ Learn how to use `node-cout` here: ### Import ```js -const cc = require('node-cout'); // CommonJS - -import cc from 'node-cout'; // MJS or TypeScript +import cc from 'node-cout'; const cout = new cc(1, { save: true, emoji: true, types: ['loading', 'uploading'] }); ``` +> You're using CommonJS and can use `require()` instead of `import`? Go on [troubleshooting](#troubleshooting). + > Parameters: > ``` > debugLevel: number @@ -54,4 +54,20 @@ If you want to use the `types` option, you can do it like this: cout.debug('Hello World', 1, types); ``` -`types` can either be a string or an array of strings, and if one of them matches with one of the types defined in the constructor, the log is going to be logged. \ No newline at end of file +`types` can either be a string or an array of strings, and if one of them matches with one of the types defined in the constructor, the log is going to be logged. + +# Troubleshooting + +Unfortunately, this is not supported anymore: + +```js +const cc = require('node-cout'); +``` + +If you want to `import` the package in your CommonJS project, add this to your `package.json` file: + +```json +{ + "type": "module" +} +``` \ No newline at end of file