bafolts / tplant

Typescript to plantuml
https://segmentationfaults.com/tplant/default.html
GNU General Public License v3.0
266 stars 34 forks source link

tplant 3.1.0 doesn't support Typescript 4.7's "moduleResolution": "Node16" #100

Closed ClementValot closed 2 years ago

ClementValot commented 2 years ago

Describe the bug

Actual behavior

Using tplant CLI with Typescript 4.7 and moduleResolution="Node16" raises the following error:

   Error: Argument for '--moduleResolution' option must be: 'node', 'classic', 'node12', 'nodenext'.

Code to reproduce

package.json

{
  "name": "tplant-node16-bug",
  "version": "1.0.0",
  "type": "module",
  "scripts": {
    "uml": "tplant -i src/**/*.ts -o diagram.puml"
  }
  "devDependencies": {
    "tplant": "^3.1.0",
    "typescript": "^4.7.4"
  }
}

tsconfig.json

{
  "compilerOptions": {
    "module": "Node16",
    "moduleResolution": "Node16",
    "target": "es6",
  },
  "exclude": [
    "node_modules"
  ]
}

"moduleResolution": "Node16" is required for Typescript 4.7 support of the exports field in package.json

bafolts commented 2 years ago

I can't recreate this problem with node 16.15.0 on macOS using the provided steps. It doesn't seem to be an issue with tplant unless the code to reproduce is modifying this tsconfig.json. Taking a shot in the dark at what the problem might be, perhaps it is node16 and not Node16?

ClementValot commented 2 years ago

My lockfile had tplant rely on an older version of Typescript, which did not support Node16, despite typescript 4.7 being installed locally. yarn upgrade tplant fixed it :)

Node16 and node16 are equivalent as far as I am aware