File tree Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Expand file tree Collapse file tree 1 file changed +6
-4
lines changed Original file line number Diff line number Diff line change 11import { NextResponse } from "next/server" ;
22import fs from "fs/promises" ;
33import path from "path" ;
4- // Import 'parse' as a named export with an alias
5- import { parse as jsoncParse } from "jsonc" ;
4+ // Correct the import for the 'jsonc' library
5+ import * as jsonc from "jsonc" ;
66
77// Remove the explicit RouteContext interface
88// interface RouteContext {
@@ -67,9 +67,11 @@ export async function GET(
6767 // Parse JSONC (JSON with comments) for validation
6868 try {
6969 // Check if jsoncParse is a function before calling (optional safety)
70- if ( typeof jsoncParse === 'function' ) {
70+ // Use the imported jsonc namespace
71+ if ( typeof jsonc . parse === 'function' ) {
7172 // Use the imported jsoncParse function directly
72- jsoncParse ( fileContent ) ;
73+ // Call parse via the jsonc namespace
74+ jsonc . parse ( fileContent ) ;
7375 } else {
7476 // Handle the case where jsonc or jsonc.parse is not loaded correctly
7577 console . error ( `[API /api/schemas/${ name } ] jsonc.parse function not found.` ) ;
You can’t perform that action at this time.
0 commit comments