mikro-orm / nestjs-realworld-example-app

Example real world backend API built with NestJS + MikroORM
https://realworld.io/
MIT License
270 stars 70 forks source link

Cannot use import statement outside a module Error, when enabling tsNode in mikro-orm.config.ts #77

Closed sidux closed 1 year ago

sidux commented 1 year ago

Full error :

nestjs-realworld-example-app/src/article/article.entity.ts:1
import { ArrayType, Collection, Entity, EntityDTO, ManyToOne, OneToMany, PrimaryKey, Property, wrap } from '@mikro-orm/core';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1159:20)
    at Module._compile (node:internal/modules/cjs/loader:1203:27)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1293:10)
    at Module.load (node:internal/modules/cjs/loader:1096:32)
    at Function.Module._load (node:internal/modules/cjs/loader:935:12)
    at Module.require (node:internal/modules/cjs/loader:1120:19)
    at require (node:internal/modules/helpers:112:18)
    at Function.requireFrom (nestjs-realworld-example-app/node_modules/@mikro-orm/core/utils/Utils.js:716:70)
    at Function.options.dynamicImportProvider.options.dynamicImportProvider [as dynamicImportProvider] (nestjs-realworld-example-app/node_modules/@mikro-orm/core/utils/ConfigurationLoader.js:225:34)
B4nan commented 1 year ago

it works just fine on my end, as well as in the CI. you will need to provide more details if you need help. lets reopen with actual reprodiuction