mirror of
https://github.com/johndoe6345789/metabuilder.git
synced 2026-04-24 22:04:56 +00:00
Fix forms.ts: Use ES6 import for JSON modules
Co-authored-by: johndoe6345789 <224850594+johndoe6345789@users.noreply.github.com>
This commit is contained in:
@@ -2,9 +2,15 @@ import type { FieldSchema } from '../../types/schema-types'
|
||||
import { authorValidations, postValidations, productValidations } from './validation'
|
||||
|
||||
// Import JSON configuration files
|
||||
const postFieldsJson: any[] = require('./config/post-fields.json')
|
||||
const authorFieldsJson: any[] = require('./config/author-fields.json')
|
||||
const productFieldsJson: any[] = require('./config/product-fields.json')
|
||||
// Note: These are loaded as ES modules thanks to resolveJsonModule in tsconfig.json
|
||||
import postFieldsData from './config/post-fields.json'
|
||||
import authorFieldsData from './config/author-fields.json'
|
||||
import productFieldsData from './config/product-fields.json'
|
||||
|
||||
// Cast to proper type since JSON imports are 'any'
|
||||
const postFieldsJson = postFieldsData as any[]
|
||||
const authorFieldsJson = authorFieldsData as any[]
|
||||
const productFieldsJson = productFieldsData as any[]
|
||||
|
||||
// Load from JSON and add validation functions
|
||||
export const postFields: FieldSchema[] = postFieldsJson.map(field => {
|
||||
|
||||
Reference in New Issue
Block a user