Building

Compile your project into JavaScript with the command npm run build

package.json:

"scripts": {
// ...
"clean-build": "rm -rf dist",
"prebuild": "npm run clean-build",
"build": "NODE_ENV=production && tsc -p tsconfig-build.json",
// ...
},
"type": "commonjs",

Implementation

HaTs projects are pre-configured with two TypeScript config files that direct the build process.

tsconfig.json

{
"compilerOptions": {
// ...
"declaration": true,
"module": "commonjs",
"noEmitOnError": true,
"outDir": "dist/",
"sourceMap": true,
"target": "es6"
// ...
}
}

tsconfig-build.json

{
"compilerOptions": {
"rootDir": "src/"
},
"exclude": ["tests", "src/**/*.test.ts"],
"extends": "./tsconfig.json"
}

Further Reading

Edit this page on GitHub

Happy TypeScript
©2022 👨🏾‍💻 Kamar Mack