Giter Club home page Giter Club logo

Comments (7)

bluelovers avatar bluelovers commented on June 26, 2024 4

why not just push cjs and esm at same time?

from parse-domain.

jhnns avatar jhnns commented on June 26, 2024 1

Yes, since 6.0.0 the package is published as ECMAScript module only. Your options are:

  • migrate your code to ECMAScript modules. It's the best long term solution but probably a lot of work. If you don't migrate, you will see this kind of error with every dependency update since more and more packages are migrating to ESM
  • import it asynchronously via await import("parse-domain") (see https://nodejs.org/dist/latest-v16.x/docs/api/modules.html)
  • stay on version 5.0.0

from parse-domain.

jkob avatar jkob commented on June 26, 2024

Is this why I am getting the following?
Error [ERR_REQUIRE_ESM]

from parse-domain.

bluelovers avatar bluelovers commented on June 26, 2024

Is this why I am getting the following?
Error [ERR_REQUIRE_ESM]

yes

from parse-domain.

jkob avatar jkob commented on June 26, 2024

It appears this is intentional so this issue will probably be closed

BREAKING CHANGE: parse-domain will now be released as native ECMAScript module. There's no CommonJS build anymore. If you're still using CommonJS, you need to import it asynchronously using await import("parse-domain"). If you're still using Node 12, you may need to update it to the latest 12.x version.

42f54e8

from parse-domain.

jhnns avatar jhnns commented on June 26, 2024

We already did it for two years, but cross-publishing ESM and CJS is not as easy as it sounds. There are a couple of pitfalls I don't want to care of any longer. A lot of module maintainers are slowly switching to ESM, so you probably won't have a choice in the long term.
If you're still using CJS, you can use version 5.0.0. It already has the parse-domain-update command, so you can keep the internal list up-to-date.

from parse-domain.

jhnns avatar jhnns commented on June 26, 2024

@bluelovers Maybe that's an option for you: #142 (comment)

from parse-domain.

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.