type-graphql: `registerEnumType` is not a named export after compilation
Describe the Bug
I started having this issue after upgrading from 2.0.0-beta.2
to 2.0.0-beta.4
. I can confirm this because it was fixed after downgrading to 2.0.0-beta.3
.
I am using SWC to compile my project.
To Reproduce
import { registerEnumType } from "type-graphql";
export enum SendTo {
Channel = "Channel",
Contact = "Contact",
}
registerEnumType(SendTo, {
name: "SendTo",
});
The following snippet will fail with these configurations.
.swcrc
{
"$schema": "https://json.schemastore.org/swcrc",
"isModule": true,
"jsc": {
"target": "esnext",
"preserveAllComments": false,
"experimental": { "keepImportAssertions": true },
"parser": {
"syntax": "typescript",
"decorators": true,
"dynamicImport": true,
"dts": true
},
"baseUrl": ".",
"paths": {}
}
}
tsconfig.json
{
"extends": "@secret/tsconfig/base.json",
"compilerOptions": {
"baseUrl": ".",
"rootDir": "./src",
"outDir": "dist",
"jsx": "preserve",
"types": ["node", "reflect-metadata"],
"paths": {}
},
"include": ["./src/**/*"],
"exclude": ["dist", "node_modules"]
}
Expected Behavior The function is imported without any issues.
Logs
Environment (please complete the following information):
- OS: MacOS 14.0
- Node: 18.18.2
- Package version: 2.0.0-beta.4
- TypeScript version: 5.3.3
About this issue
- Original URL
- State: closed
- Created 6 months ago
- Comments: 15 (12 by maintainers)
Thanks for the report. Our publish workflow is not working so I do publish by myself and something went wrong.
Should be ok now with
2.0.0-beta.6
.@MichalLytek the v5-package is nearly empty; the
build
directory is missing.I guess this was me doing deps upgrade without checking build results:
We now canβt trick typescript to emit ESM for commonjs project, we need a real ESM project to emit ESM code.
Should be fixed by 51ff280, will see in
beta.5
if that works π