Closed joshdavenport closed 7 months ago
Let me piggy back onto this issue. I do not the exact issue (since I'm using the default next js config which does not use type: module
) but I also can not get the generate command to run and maybe these are related.
I am running into an issue where next-rest-framework generate
tries to typecheck all node_modules
:
Compiling endpoints...
✘ [ERROR] The constant "Busboy" must be initialized
node_modules/@fastify/busboy/lib/main.d.ts:11:13:
11 │ export const Busboy: BusboyConstructor;
╵ ~~~~~~
✘ [ERROR] The constant "createAccordionScope" must be initialized
node_modules/@radix-ui/react-accordion/dist/index.d.ts:6:13:
6 │ export const createAccordionScope: import("@radix-ui/react-context"...
╵ ~~~~~~~~~~~~~~~~~~~~
✘ [ERROR] The constant "Accordion" must be initialized
My command:
npx next-rest-framework generate --tsConfigPath /Users/[...]/tsconfig.json
Let me piggy back onto this issue. I do not the exact issue (since I'm using the default next js config which does not use
type: module
) but I also can not get the generate command to run and maybe these are related. I am running into an issue wherenext-rest-framework generate
tries to typecheck allnode_modules
:Compiling endpoints... ✘ [ERROR] The constant "Busboy" must be initialized node_modules/@fastify/busboy/lib/main.d.ts:11:13: 11 │ export const Busboy: BusboyConstructor; ╵ ~~~~~~ ✘ [ERROR] The constant "createAccordionScope" must be initialized node_modules/@radix-ui/react-accordion/dist/index.d.ts:6:13: 6 │ export const createAccordionScope: import("@radix-ui/react-context"... ╵ ~~~~~~~~~~~~~~~~~~~~ ✘ [ERROR] The constant "Accordion" must be initialized
My command:
npx next-rest-framework generate --tsConfigPath /Users/[...]/tsconfig.json
If your TS config has skipLibCheck
set to true
, then it should not check node_modules
. I have also identified the original problem in this issue and working on a fix ASAP.
@blomqma
That's weird because skipLibCheck: true
is part of my TSConfig.
This is my TSConfig (Standard from NextJS I think):
{
"compilerOptions": {
"target": "es5",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
"incremental": true,
"plugins": [
{
"name": "next"
}
],
"paths": {
"@/*": ["./src/*"]
}
},
"include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
"exclude": ["node_modules"]
}
This is now fixed in v5.0.1
. There was an issue with the extensions of the bundled code generated by the CLI causing those modules not working with the CLI Node.js process when explicitly using ESM. Now those file extensions are explicitly set to .cjs
so they are always interpreted as CJS, making the CLI work with all module systems in your package.json
.
I must be missing something, but I'm getting this error with 5.0.0:
The file is definitely there, and it starts working when I remove
"type": "module"
from my package.json. Not sure if there is something bigger going on or I'm doing something silly!