Giter Site home page Giter Site logo

Comments (4)

lyricnz avatar lyricnz commented on July 1, 2024

This feels like a tsconfig problem? My tsconfig.json file is

{
  "compilerOptions": {
    "target": "es2022",
    "module": "commonjs",
    "lib": [
      "es2022"
    ],
    "declaration": true,
    "strict": true,
    "noImplicitAny": true,
    "strictNullChecks": true,
    "noImplicitThis": true,
    "alwaysStrict": true,
    "esModuleInterop": true,
    "noUnusedLocals": false,
    "noUnusedParameters": false,
    "noImplicitReturns": true,
    "noFallthroughCasesInSwitch": false,
    "inlineSourceMap": true,
    "inlineSources": true,
    "experimentalDecorators": true,
    "strictPropertyInitialization": false,
    "typeRoots": [
      "./node_modules/@types"
    ]
  },
  "exclude": [
    "node_modules",
    "dist"
  ]
}

and the generated .js file includes

Object.defineProperty(exports, "__esModule", { value: true });
const chai = __importStar(require("chai"));
const chai_as_promised_1 = __importDefault(require("chai-as-promised"));
const instrumentedResource_1 = require("../../drivers/instrumentedResource");
const driverInterface_1 = require("../../drivers/driverInterface");
chai.use(chai_as_promised_1.default);

from chai-as-promised.

43081j avatar 43081j commented on July 1, 2024

you're in a commonjs project (module: "commonjs")

8.0.0 is esm-only (like chai 5.x is too)

so you can either:

  • stay on 7.x if you want to continue using commonjs
  • migrate to ESM ("module": "nodenext", and set "type": "module" in your package.json)

from chai-as-promised.

lyricnz avatar lyricnz commented on July 1, 2024

Thanks. It looks like doing that and I'll have to change 500+ imports to include explicit .js extension?

from chai-as-promised.

43081j avatar 43081j commented on July 1, 2024

Node will probably still handle the imports without extensions but I guess typescript may complain if they're not exported paths 😬

It should be scriptable at least but I understand your pain (code review won't be a fun one)

You may be able to loosen typescript's constraints by using module: "bundler"

from chai-as-promised.

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.