Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ts-results does not work with esbuild #78

Open
misl-smlz opened this issue Sep 26, 2023 · 3 comments
Open

ts-results does not work with esbuild #78

misl-smlz opened this issue Sep 26, 2023 · 3 comments

Comments

@misl-smlz
Copy link

test.ts

import { Ok, Result } from 'ts-results'

let result: Result<number, string> = Ok(1)
console.log(result)

compile with
esbuild src/test.ts --bundle --platform=node --minify --define:import.meta.vitest=undefined --outdir=dist --outbase=src

run fails

node dist/test.js         
node:internal/modules/cjs/loader:1073
  throw err;
  ^

Error: Cannot find module 'tslib'
Require stack:
- node dist/test.js         
node:internal/modules/cjs/loader:1073
  throw err;
  ^

Error: Cannot find module 'tslib'
Require stack:
- /home/ubuntu/dev/ts-results-error/dist/test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1070:15)
    at Module._load (node:internal/modules/cjs/loader:923:27)
    at Module.require (node:internal/modules/cjs/loader:1137:19)
    at require (node:internal/modules/helpers:121:18)
    at /home/ubuntu/dev/ts-results-error/dist/test.js:1:850
    at /home/ubuntu/dev/ts-results-error/dist/test.js:1:621
    at /home/ubuntu/dev/ts-results-error/dist/test.js:1:767
    at /home/ubuntu/dev/ts-results-error/dist/test.js:1:216
    at Object.<anonymous> (/home/ubuntu/dev/ts-results-error/dist/test.js:1:937)
    at Module._compile (node:internal/modules/cjs/loader:1255:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/ubuntu/dev/ts-results-error/dist/test.js'
  ]
}

Node.js v20.3.0/dist/test.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1070:15)
    at Module._load (node:internal/modules/cjs/loader:923:27)
    at Module.require (node:internal/modules/cjs/loader:1137:19)
    at require (node:internal/modules/helpers:121:18)
    at /home/ubuntu/dev/ts-results-error/dist/test.js:1:850
    at /home/ubuntu/dev/ts-results-error/dist/test.js:1:621
    at /home/ubuntu/dev/ts-results-error/dist/test.js:1:767
    at /home/ubuntu/dev/ts-results-error/dist/test.js:1:216
    at Object.<anonymous> (/home/ubuntu/dev/ts-results-error/dist/test.js:1:937)
    at Module._compile (node:internal/modules/cjs/loader:1255:14) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/ubuntu/dev/ts-results-error/dist/test.js'
  ]
}

Node.js v20.3.0
@willredington
Copy link

+1, this was closed in #32 but it's still an issue

@tv42
Copy link

tv42 commented Oct 27, 2023

Duplicate of #37 ? As far as I know, fixed but not released.

@san4d
Copy link

san4d commented Jan 26, 2024

I've ended up using the ts-result-es fork mentioned in one of the above MRs:
https://www.npmjs.com/package/ts-results-es

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants