lukeed / tsm

TypeScript Module Loader
MIT License
1.18k stars 19 forks source link

pnpm support #25

Closed ai closed 2 years ago

ai commented 2 years ago

When I call (or do the same in package.scripts but without pnpx):

pnpx tsm node_modules/.bin/uvu . '\\.test\\.(ts|js)$'

I got in pnpm:

TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension "" for /home/ai/Dev/nanostores/node_modules/.bin/uvu
    at new NodeError (node:internal/errors:371:5)
    at Object.file: (node:internal/modules/esm/get_format:72:15)
    at defaultGetFormat (node:internal/modules/esm/get_format:85:38)
    at defaultLoad (node:internal/modules/esm/load:22:14)
    at load (file:///home/ai/Dev/nanostores/node_modules/.pnpm/tsm@2.2.1/node_modules/tsm/loader.mjs:1:1017)
    at async ESMLoader.load (node:internal/modules/esm/loader:353:20)
    at async ESMLoader.moduleProvider (node:internal/modules/esm/loader:274:47)
    at async link (node:internal/modules/esm/module_job:70:21) {
  code: 'ERR_UNKNOWN_FILE_EXTENSION'
}

Reproduction:

git clone git@github.com:nanostores/nanostores.git
git checkout chore/pnpm
pnpm unit
PabloSzx commented 2 years ago

But node_modules/.bin/uvu is not a JavaScript/TypeScript file

image

When changing to: "unit": "tsm node_modules/uvu/bin.js . '\\.test\\.(ts|js)$'", everything works fine

ai commented 2 years ago

Got it. Thanks. My mistake.