From 05b5e14bfd110d61d04860ae30212b3d13ae3cc0 Mon Sep 17 00:00:00 2001 From: Fionn Date: Tue, 8 Nov 2022 08:45:06 +0100 Subject: [PATCH] setup to emit esmodules instead of commonjs --- app/package.json | 5 +++-- app/tsconfig.json | 9 +++++---- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/app/package.json b/app/package.json index 86f7e17..a333ca6 100644 --- a/app/package.json +++ b/app/package.json @@ -3,10 +3,11 @@ "version": "1.0.0", "description": "", "main": "index.js", + "type": "module", "scripts": { "test": "echo \"Error: no test specified\" && exit 1", "prerun:dev": "npm install && rimraf dist/*", - "run:prod": "node --inspect=0.0.0.0:9229 dist/app.js", + "run:prod": "node --inspect=0.0.0.0:9229 --es-module-specifier-resolution=node dist/app.js", "run:dev": "tsc-watch --onSuccess \"npm run run:prod\" --onFailure \"echo WHOOPS! Server compilation failed\"" }, "keywords": [], @@ -30,4 +31,4 @@ "tsc-watch": "^5.0.3", "typescript": "^4.7.4" } -} +} \ No newline at end of file diff --git a/app/tsconfig.json b/app/tsconfig.json index 79bf11f..7fa225a 100644 --- a/app/tsconfig.json +++ b/app/tsconfig.json @@ -2,10 +2,10 @@ "compileOnSave": false, "compilerOptions": { "outDir": "dist", - "module": "commonjs", - "target": "es2015", + "module": "ES2022", + "target": "ES2022", "lib": [ - "es2017" + "ES2022" ], "sourceMap": true, "strictNullChecks": true, @@ -13,6 +13,7 @@ "preserveConstEnums": true, "removeComments": true, "forceConsistentCasingInFileNames": true, - "esModuleInterop": true + "esModuleInterop": true, + "moduleResolution": "Node" } } \ No newline at end of file