GithubHelp home page GithubHelp logo

Comments (6)

arthurwolf avatar arthurwolf commented on June 11, 2024 2

Ok for reference, I found the solution again, it's here https://stackoverflow.com/questions/70309135/chalk-error-err-require-esm-require-of-es-module and it goes:

    npm uninstall chalk
    npm i [email protected]

from chalk.

sindresorhus avatar sindresorhus commented on June 11, 2024

https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c

from chalk.

arthurwolf avatar arthurwolf commented on June 11, 2024

Thanks for the quick reply.

So, this says

Use import foo from 'foo' instead of const foo = require('foo') to import the package.

(this is also what ChatGPT said to do)

The problem with that, is that I follow the chalk documentation, so I'm in fact already using import ...

From my code:

import chalk               from 'chalk';

So what is going on here ??

from chalk.

Qix- avatar Qix- commented on June 11, 2024

Check that TS isn't compiling import statements as CJS require calls. Beyond that this is really a question for TS/node-ts, not chalk.

from chalk.

dcsan avatar dcsan commented on June 11, 2024

OK so chalk is one of these militant ESM only packages moving forward and basically incompatible with typescript for now?
awesome job guys.

from chalk.

Qix- avatar Qix- commented on June 11, 2024

ESM and typescript are extremely compatible. Perhaps not taking such a negative tone with people you don't know and provide you source code for free would get you further, too.

Everything in this thread that needs to be said has been. At this point if you have problems with typescript and ESM I suggest Google.

from chalk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.