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

Build Errors from README instructions using nodejs v20 #491

Open
btakita opened this issue Jun 6, 2024 · 1 comment
Open

Build Errors from README instructions using nodejs v20 #491

btakita opened this issue Jun 6, 2024 · 1 comment

Comments

@btakita
Copy link

btakita commented Jun 6, 2024

Running the first step of the Build section causes some errors when using nodejs v20. nodejs v18 successfully builds.

pnpm install && cd core && pnpm install && cd ../
pnpm run build
pnpm run build

> @coasys/[email protected] build /home/brian/work/coasys/ad4m/core
> patch-package && tsc && pnpm run buildSchema && pnpm run bundle

patch-package 8.0.0
Applying patches...
Unrecognized patch file in patches directory [email protected]
---
patch-package finished with 1 warning(s).

> @coasys/[email protected] buildSchema /home/brian/work/coasys/ad4m/core
> node --es-module-specifier-resolution=node lib/src/buildSchema.js

node:internal/modules/esm/resolve:264
    throw new ERR_MODULE_NOT_FOUND(
          ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/brian/work/coasys/ad4m/core/lib/src/agent/AgentResolver' imported from /home/brian/work/coasys/ad4m/core/lib/src/buildSchema.js
@btakita btakita changed the title Build Errors from README instructions Build Errors from README instructions using nodejs v20 Jun 7, 2024
btakita added a commit to btakita/ad4m that referenced this issue Jun 9, 2024
@btakita
Copy link
Author

btakita commented Jun 10, 2024

This issue is a bit tricky. NodeJS v20 seems to want the file extension name using NodeJS conventions of *.js for *.ts modules. However, Deno is used & it expects *.ts extension names for *.ts modules.

If both NodeJS & Deno are going be supported, it may make sense to convert the *.ts source into *.js + *.d.ts. There are some other advantages to using *.js + *.d.ts. Mainly around optimizing the performance + payload size. Such as:

  • No need for a tsc build
    • Simplify the overall build
    • Source files are directly used in the npm package
  • more straightforward stack traces
  • private *.js function signatures with a different ts representation
  • private *.js functions

Of course the disadvantage would be not using Typescript. JSDoc Types can mitigate the lack of types in the js implementation. While JSDocs are decent at representing types, they are not a replacement. And are missing some features, particularly around generics.

btakita added a commit to btakita/ad4m that referenced this issue Jun 12, 2024
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

1 participant