Closed Type1J closed 5 months ago
Note that the TypeScript errors are all from node_modules
, not the project code.
Which version of next-rest-framework
are you using? I'm unable to reproduce this with the instructions you provided, do you have a reproducible example?
@blomqma I am facing the exact same issue. I can add you to my repo if you want yo know more about this issue.
This change breaks openapi.json
generation for us. I just upgraded from v5.1.3 to v5.1.9 and suddenly I get an openapi.json
file that has an empty paths
object. Diving into the node_modules
and commenting out the line packages: "external"
fixes this for me.
This change breaks
openapi.json
generation for us. I just upgraded from v5.1.3 to v5.1.9 and suddenly I get anopenapi.json
file that has an emptypaths
object. Diving into thenode_modules
and commenting out the linepackages: "external"
fixes this for me.
Thanks, seems like the external packages option needs to be dropped for now, I have included that fix in v5.1.10
. Would be great to confirm if this fix addresses the issue for others as well as I'm still unable to reproduce this myself.
It seems unrelated. The original problem seems to have something to do with esbuild not ignoring node_modules for TypeScript.
Tested v5.1.10 and the same errors are still happening.
Running into the same issue, even on 5.1.10.
Replacing the following function in node_modules/next-rest-framework/dist/cli/index.js
var compileEndpoints = async () => {
await clearTmpFolder();
console.info(import_chalk2.default.yellowBright("Compiling endpoints..."));
const entryPoints = await (0, import_tiny_glob.default)("./**/*.ts");
await (0, import_esbuild.build)({
entryPoints,
bundle: true,
format: "cjs",
platform: "node",
outdir: NEXT_REST_FRAMEWORK_TEMP_FOLDER_NAME,
outExtension: { ".js": ".cjs" }
});
};
with this one , basically changing the entrypoints from ./ to ./src, solves it for me. Maybe this helps debugging this issue, it's certainly not a long term solution unfortunatly
var compileEndpoints = async () => {
await clearTmpFolder();
console.info(import_chalk2.default.yellowBright("Compiling endpoints..."));
const entryPoints = await (0, import_tiny_glob.default)("./src/**/*.ts");
await (0, import_esbuild.build)({
entryPoints,
bundle: true,
loader: {
".node": "file" // needed for "sharp"
},
format: "cjs",
platform: "node",
outdir: NEXT_REST_FRAMEWORK_TEMP_FOLDER_NAME,
outExtension: { ".js": ".cjs" }
});
};
This change breaks
openapi.json
generation for us. I just upgraded from v5.1.3 to v5.1.9 and suddenly I get anopenapi.json
file that has an emptypaths
object. Diving into thenode_modules
and commenting out the linepackages: "external"
fixes this for me.Thanks, seems like the external packages option needs to be dropped for now, I have included that fix in
v5.1.10
. Would be great to confirm if this fix addresses the issue for others as well as I'm still unable to reproduce this myself.
Upgrading to v5.1.10 fixes this for us. I also cannot reproduce the behaviour others are having.
basically changing the entrypoints from ./ to ./src, solves it for me
@mirko314 unfortunately this will break for anyone not using the src
directory. If others who are using the src
directory can test this solution though, or at least confirm whether or not they are using the src
directory while seeing these issues, it might be a case of just adding something like
const entryPoints = await (0, import_tiny_glob.default)(srcExists ? "./src/**/*.ts" : "./**/*.ts");
Did some more digging and was finally able to reproduce and fix this in https://github.com/blomqma/next-rest-framework/pull/141. This problem only occurs when using npm
which treats the node_modules
folder differently than e.g. pnpm. The node_modules
folder is now explicitly ignored by a different globbing algorithm that fixes the issue for npm
/npx
. Upgrading to v5.1.11
should address this so closing this issue for now, thanks for the help!
I have an issue similar to #129 . I have used
create-next-app
to create the project, installedzod
3.22.2, andnext-rest-framework
.Running
next-rest-framework generate
(from either annpm run
script ornpx
) saysCompiling endpoints...
followed by many TypeScript errors. Mytsconfig.json
is the default generated bycreate-next-app
, and I can runnpm run dev
with no issues. However, I can't get theopenapi.json
file generated.Please help!