kiliman / remix-typedjson

This package is a replacement for superjson to use in your Remix app. It handles a subset of types that `superjson` supports, but is faster and smaller.
MIT License
435 stars 19 forks source link

Error: Cannot find module 'tslib' #12

Closed ryanwoodcox closed 1 year ago

ryanwoodcox commented 1 year ago

I am testing a deployment to fly.io and am getting an error:

[info] > start
[info] > cross-env NODE_ENV=production node ./build/server.js
[info] Error: Cannot find module 'tslib'
[info] Require stack:
[info] - /myapp/node_modules/remix-typedjson/dist/remix.js
[info] - /myapp/node_modules/remix-typedjson/dist/index.js
[info] - /myapp/build/index.js
[info] - /myapp/build/server.js
[info] at Function.Module._resolveFilename (node:internal/modules/cjs/loader:956:15)
[info] at Function.Module._load (node:internal/modules/cjs/loader:804:27)
[info] at Module.require (node:internal/modules/cjs/loader:1028:19)
[info] at require (node:internal/modules/cjs/helpers:102:18)
[info] at Object.<anonymous> (/myapp/node_modules/remix-typedjson/dist/remix.js:4:17)
[info] at Module._compile (node:internal/modules/cjs/loader:1126:14)
[info] at Object.Module._extensions..js (node:internal/modules/cjs/loader:1180:10)
[info] at Module.load (node:internal/modules/cjs/loader:1004:32)
[info] at Function.Module._load (node:internal/modules/cjs/loader:839:12)
[info] at Module.require (node:internal/modules/cjs/loader:1028:19)

I noticed your tsconfig.json has importHelpers set to true. https://github.com/kiliman/remix-typedjson/blob/c1ed8747d60cd651be689fc1eb327f4a00701f81/tsconfig.json#L13

Are consumers responsible for also installing tslib, or is there a better way to resolve this error?

kiliman commented 1 year ago

Hmm. Not sure why you're getting this error. Let me try testing with the Indie Stack and deploy to fly.

ryanwoodcox commented 1 year ago

Thanks (I was using the blues stack for my example)

stephen776 commented 1 year ago

I am currently experiencing the same issue when deploying to fly.io

kiliman commented 1 year ago

Ugh. Sorry. I've been busy and haven't had a chance to check. I'll work on it this weekend.

stephen776 commented 1 year ago

Is installing tslib in my project a suitable workaround for the time being?

dahlbyk commented 1 year ago

Is installing tslib in my project a suitable workaround for the time being?

For what it's worth, we tried this and it didn't seem to help.

kiliman commented 1 year ago

Sorry for the delay, but I've updated the package (v0.1.4) to remove the importHelpers: true entry. It probably was set by default from some template.

Anyway, I created a sample using Remix Indie stack and remix-typedjson v0.1.4 and it was able to build and deploy properly.

Let me know if you're still having issues.

https://github.com/kiliman/remix-indie-typedjson/actions/runs/3373091674/jobs/5597332634

https://remix-indie-typedjson.fly.dev/

Fixed in https://github.com/kiliman/remix-typedjson/commit/1539fd915bd7a4b87e1b74ac5c94df5b5d51eaaf