Ranma
Ranma
NNuxt
Created by Ranma on 1/25/2025 in #❓・help
Nuxt & Mikro-ORM
By doing this there is no need for an extra module
10 replies
NNuxt
Created by Ranma on 1/25/2025 in #❓・help
Nuxt & Mikro-ORM
@Mittchel Thank you! I found the articles you mentioned and was stuck at importing the entities. I found a solution by setting the entities in the config file as follows:
// mikro-orm.config.ts
import {
PostgreSqlDriver,
type Options,
ReflectMetadataProvider,
} from '@mikro-orm/postgresql'
import * as entities from './entities/index.js'
import 'dotenv/config'

const config: Options = {
driver: PostgreSqlDriver,
entities: [...Object.values(entities)].filter(
entity => typeof entity === 'function',
),
debug: true,
metadataProvider: ReflectMetadataProvider,
}

export default config
// mikro-orm.config.ts
import {
PostgreSqlDriver,
type Options,
ReflectMetadataProvider,
} from '@mikro-orm/postgresql'
import * as entities from './entities/index.js'
import 'dotenv/config'

const config: Options = {
driver: PostgreSqlDriver,
entities: [...Object.values(entities)].filter(
entity => typeof entity === 'function',
),
debug: true,
metadataProvider: ReflectMetadataProvider,
}

export default config
10 replies