Git Product home page Git Product logo

Comments (3)

chmanie avatar chmanie commented on July 22, 2024

Nice! Do you have any form of general migration guide that also touches on the topic of keeping support for CJS?

from wdio-intercept-service.

christian-bromann avatar christian-bromann commented on July 22, 2024

Not really but I would refer to this document: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c#how-can-i-move-my-commonjs-project-to-esm. In regards of supporting both: I don't have a clear solution to this but I plan to have a compiler (e.g. rollup, maybe another TS config) that bundles the files as CJS modules. The package.json then needs to look like this:

  "main": "./build/index.cjs.js",
  "type": "module",
  "module": "./build/index.js",
  "exports": {
    ".": [
      {
        "import": "./build/index.js",
        "require": "./build/index.cjs.js"
      },
      "./build/index.cjs.js"
    ]
  },
  "types": "./build/index.d.ts",
  "typeScriptVersion": "3.8.3",

from wdio-intercept-service.

christian-bromann avatar christian-bromann commented on July 22, 2024

Update: my initial assumption that CJS services/reporters would stop working when running WebdriverIO within ESM context is wrong. They continue to work as is without any changes required. However I still suggest to do this ESM transition eventually as dependencies might migrate to ESM and stop working. Given WebdriverIO dynamically imports services and plugins there is no need to build a hybrid package for CJS and ESM. Plugins can just export ESM code and it will work fine for users running CJS and ESM.

from wdio-intercept-service.

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.