I have the following turborepo setup (it's the default nextjs example, with deleted docs app and added api (nestjs) app):
apps/
api (nestjs)
web (nextjs)
packages/
types (ts types to share across api and web)
src/
index.ts
index.ts
Reproduction repo is here: https://github.com/jacobdo2/types-nestjs-nextjs-turbo
In packages/types, I have declared two dummy types interface Example and enum Example enum. When I import Example inside the nestjs app, it compiles fine, but when I import the enum, I get the following error:
api:dev: export * from "./src";
api:dev: ^^^^^^
api:dev:
api:dev: SyntaxError: Unexpected token 'export'
api:dev: at Object.compileFunction (node:vm:352:18)
api:dev: at wrapSafe (node:internal/modules/cjs/loader:1032:15)
api:dev: at Module._compile (node:internal/modules/cjs/loader:1067:27)
api:dev: at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
api:dev: at Module.load (node:internal/modules/cjs/loader:981:32)
api:dev: at Function.Module._load (node:internal/modules/cjs/loader:822:12)
api:dev: at Module.require (node:internal/modules/cjs/loader:1005:19)
api:dev: at require (node:internal/modules/cjs/helpers:102:18)
api:dev: at Object.<anonymous> (/Users/hello/Projects/types-nestjs-nextjs-turbo/apps/api/src/app.controller.ts:2:1)
This issue does not appear on build, but only on dev.