setup to emit esmodules instead of commonjs

main
Fionn 2 years ago
parent 57db5860e3
commit 05b5e14bfd

@ -3,10 +3,11 @@
"version": "1.0.0", "version": "1.0.0",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"type": "module",
"scripts": { "scripts": {
"test": "echo \"Error: no test specified\" && exit 1", "test": "echo \"Error: no test specified\" && exit 1",
"prerun:dev": "npm install && rimraf dist/*", "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\"" "run:dev": "tsc-watch --onSuccess \"npm run run:prod\" --onFailure \"echo WHOOPS! Server compilation failed\""
}, },
"keywords": [], "keywords": [],
@ -30,4 +31,4 @@
"tsc-watch": "^5.0.3", "tsc-watch": "^5.0.3",
"typescript": "^4.7.4" "typescript": "^4.7.4"
} }
} }

@ -2,10 +2,10 @@
"compileOnSave": false, "compileOnSave": false,
"compilerOptions": { "compilerOptions": {
"outDir": "dist", "outDir": "dist",
"module": "commonjs", "module": "ES2022",
"target": "es2015", "target": "ES2022",
"lib": [ "lib": [
"es2017" "ES2022"
], ],
"sourceMap": true, "sourceMap": true,
"strictNullChecks": true, "strictNullChecks": true,
@ -13,6 +13,7 @@
"preserveConstEnums": true, "preserveConstEnums": true,
"removeComments": true, "removeComments": true,
"forceConsistentCasingInFileNames": true, "forceConsistentCasingInFileNames": true,
"esModuleInterop": true "esModuleInterop": true,
"moduleResolution": "Node"
} }
} }
Loading…
Cancel
Save