You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm playing around with nestia, and really like it so far, it looks like it'll solve a lot of our pain points around using DTOs and generating a client API. I'm trying to get the SDK to play nice with ESM, but I seem to be running into issues around import() and require(). Is it ESM compatible?
$ npx nestia sdk "src/**/*.controller.ts" --out ./nestia_api
-----------------------------------------------------------
Nestia SDK Generator
-----------------------------------------------------------
Analyzing reflections
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
Error on ".../src/agents/agents.controller.ts" file. Check your code.
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: .../src/agents/agents.controller.ts
require() of ES modules is not supported.
require() of .../src/agents/agents.controller.ts from .../node_modules/@nestia/sdk/lib/analyses/ReflectAnalyzer.js is an ES module file as it is a .ts file whose nearest parent package.json contains "type": "module" which defines all .ts files in that package scope as ES modules.
Instead change the requiring code to use import(), or remove "type": "module" from .../package.json.
at createErrRequireEsm (.../node_modules/ts-node/dist-raw/node-internal-errors.js:46:15)
at assertScriptCanLoadAsCJSImpl (.../node_modules/ts-node/dist-raw/node-internal-modules-cjs-loader.js:584:11)
at Object.require.extensions.<computed> [as .ts] (.../node_modules/ts-node/src/index.ts:1610:5)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Function.Module._load (node:internal/modules/cjs/loader:958:12)
at Module.require (node:internal/modules/cjs/loader:1141:19)
at require (node:internal/modules/cjs/helpers:110:18)
at .../node_modules/@nestia/sdk/src/analyses/ReflectAnalyzer.ts:22:41 {
code: 'ERR_REQUIRE_ESM'
}
The text was updated successfully, but these errors were encountered:
Question
I'm playing around with nestia, and really like it so far, it looks like it'll solve a lot of our pain points around using DTOs and generating a client API. I'm trying to get the SDK to play nice with ESM, but I seem to be running into issues around import() and require(). Is it ESM compatible?
My tsconfig uses
The text was updated successfully, but these errors were encountered: