seasonedcc/composable-functions

@decs/typeschema causing errors

deanfields opened this issue · 7 comments

I keep getting these errors in the terminal for each of the following packages:

@deepkit/type @effect/data/Either @effect/schema/Schema fp-ts/Either ow valibot yup

 import { validate } from "@deepkit/type";
  You can mark the path "@deepkit/type" as external to exclude it from the bundle, which will remove this error.

Running on Node version 18.17.1

Taking a look at the installed domain-functions package on my machine is has a package.json inside of it with:

  "module": "./esm/index.js",
  "main": "./script/index.js",
  "types": "./types/index.d.ts",
  "name": "domain-functions",
  "version": "2.1.0",
  "description": "Decouple your business logic from your controllers. With first-class type inference from end to end.",
  "license": "MIT",
  "author": "Seasoned",
  "bugs": {
    "url": "https://github.com/seasonedcc/domain-functions/issues"
  },
  "homepage": "https://github.com/seasonedcc/domain-functions",
  "exports": {
    ".": {
      "import": {
        "types": "./types/index.d.ts",
        "default": "./esm/index.js"
      },
      "require": {
        "types": "./types/index.d.ts",
        "default": "./script/index.js"
      }
    }
  },
  "scripts": {
    "test": "node test_runner.js"
  },
  "dependencies": {
    "@decs/typeschema": "^0.10.0"
  },
  "devDependencies": {
    "@types/node": "^18.11.9",
    "picocolors": "^1.0.0",
    "@sinclair/typebox": "*",
    "runtypes": "*",
    "superstruct": "*",
    "valibot": "*",
    "yup": "*",
    "zod": "^3.21.4",
    "@deno/shim-deno": "~0.16.1",
    "undici": "^5.21.0"
  }
}```

I presume because these are all dev dependencies this is what is causing the problem? 

Hi @deanfields , thanks for reporting this issue.
We are rolling back v2.1.0 - you can install v2.2.0 - and it should solve this issue for now.

@decs , just a heads up:
We had to rollback typeschema because we had issues being opened here and also in packages that depend on domain-functions.

decs commented

Hey, folks! That error message shows up because Vite doesn't handle optional peer packages well. We got an issue related to that (decs/typeschema#12) and solved it by creating a Vite plugin that declares all of the optional peer packages as external.

https://github.com/decs/typeschema#vite

@decs we didn't see that coming and should have released a major then. We should also investigate other bundlers and solutions before bringing typeschema back. I'll wait for @diogob - which has been leading this endeavor - to help us decide which action to take here.

diogob commented

@gustavoguichard @decs I'm not sure if I'm comfortable having optional dependencies at all after this incident. We already had this issue with deno. TS/JS is too fragmented for us to count on a particular build environment.
I would like to go the way of zero dependencies again.

diogob commented

I'm closing this since we already reverted the changes in the version 2.2.0 of the NPM package and in the master branch as well.