diff --git a/.github/workflows/ci-typescript.yaml b/.github/workflows/ci-typescript.yaml index 1c174753..9d382b1a 100644 --- a/.github/workflows/ci-typescript.yaml +++ b/.github/workflows/ci-typescript.yaml @@ -45,7 +45,9 @@ jobs: --ts_proto_out=./out \ --ts_proto_opt=outputIndex=true \ --ts_proto_opt=globalThisPolyfill=true \ - --ts_proto_opt=useExactTypes=false + --ts_proto_opt=useExactTypes=false \ + --ts_proto_opt=esModuleInterop=true \ + --ts_proto_opt=importSuffix=.js - name: Compile run: pnpm run build diff --git a/package.json b/package.json index aa763b88..e5dbd325 100644 --- a/package.json +++ b/package.json @@ -7,8 +7,14 @@ "type": "git", "url": "https://github.com/BluEye-Robotics/ProtocolDefinitions.git" }, - "main": "dist/index.js", - "types": "dist/index.d.ts", + "type": "module", + "exports": { + ".": { + "types": "./dist/index.d.ts", + "import": "./dist/index.js" + } + }, + "types": "./dist/index.d.ts", "files": [ "dist" ], diff --git a/tsconfig.json b/tsconfig.json index fc30754e..54339cbc 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -1,7 +1,8 @@ { "compilerOptions": { - "target": "ES2020", - "module": "CommonJS", + "target": "ES2022", + "module": "NodeNext", + "moduleResolution": "NodeNext", "declaration": true, "outDir": "dist", "strict": true,