Code Monkey home page Code Monkey logo

Comments (14)

mikemykhaylov avatar mikemykhaylov commented on August 20, 2024 2

@orta

node12 for 12, esnext for the others I think

With Typescript 4.7 introducing "module": "node16" and "nodenext", would it make sense to use the "node16" for Node 16 + ESM and derivative configs?

from bases.

orta avatar orta commented on August 20, 2024 1

Ah yeah, nodenext!

from bases.

cspotcode avatar cspotcode commented on August 20, 2024

Are these to use module: node12 or module: esnext?

from bases.

orta avatar orta commented on August 20, 2024

node12 for 12, esnext for the others I think

from bases.

cspotcode avatar cspotcode commented on August 20, 2024

Does esnext allow dynamic imports in a CommonJS file? Or maybe we're getting nodenext and esnext mixed up?

As far as I know, node12 and nodenext are the only module options that allow mixing sync and async module loading in a CommonJS file:

import foo from 'foo'; // compiled to require()
const promise = import('bar'); // compiled to import()

from bases.

bodaso avatar bodaso commented on August 20, 2024

With TypeScript 4.5 and module: es2022 out, would you say this is a good node16-esm config to start with?

{
  "$schema": "https://json.schemastore.org/tsconfig",
  "display": "Node 16 ESM",

  "compilerOptions": {
    "module": "es2022",
    "moduleResolution": "node",
    "target": "es2021",
    "lib": ["es2021"],

    "strict": true,
    "esModuleInterop": true,
    "skipLibCheck": true,
    "forceConsistentCasingInFileNames": true
  }
}

from bases.

cspotcode avatar cspotcode commented on August 20, 2024

@bodazhao Should these node*-esm configs use the forthcoming module: nodenext or module: node12? I thought that was the intent, perhaps @orta knows.

from bases.

bodaso avatar bodaso commented on August 20, 2024

that has been delayed, see microsoft/TypeScript#46452

from bases.

frank-dspeed avatar frank-dspeed commented on August 20, 2024

No sorry it is not delayed it is integrated and there is no save default stay with node as default is fine use node12 (cjs & es2015 modules aka __esModules = true)if you want to depend on import export filds of package.json files and finally use esnext the most complicated one which adds the same as node12 but out of esm context view.

from bases.

orta avatar orta commented on August 20, 2024

Handled by #90 - at least for node 16

from bases.

frank-dspeed avatar frank-dspeed commented on August 20, 2024

@mmykhaylov depends on the packages that the project consumes this sets if if moduleResolution is not configured diffrent also the moduleResolution so everything with a package.json and not propper exports fild will fail.

i added a node16 consumer folder as composit project for that case and stick with node as resolve algo for the legacy part my final target is ESNext but you could set it to node16 if you do nodejs only packaging and code.

from bases.

evantill avatar evantill commented on August 20, 2024

@orta what's the meaning of label you can do this?

something like pr are welcomes ? or like do it in your tsconfig ?

from bases.

cspotcode avatar cspotcode commented on August 20, 2024

from bases.

orta avatar orta commented on August 20, 2024

Actually, this should be closed - we dont support merging tsconfigs now that they can have array extends - I guess you can use node16 and esm now?

from bases.

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.