Skip to content

Commit 716c814

Browse files
Optimize Production Build
On the output of the files, the JS Docs were being stripped. This is not ideal as it reduces the intelisense integrations. Fix the build output so that it no longer nests the binaries in a src folder, and now the prod bins are now in the bin folder, reducing structural complexity on publish.
1 parent 3b2c995 commit 716c814

File tree

3 files changed

+19
-2
lines changed

3 files changed

+19
-2
lines changed

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
"scripts": {
88
"start": "node ./bin/index.js",
99
"build:Dev": "tsc",
10-
"build:Prod": "tsc --sourceMap false",
10+
"prebuild:Prod": "tsc -p prod.tsconfig.json --emitDeclarationOnly false",
11+
"build:Prod": "tsc -p prod.tsconfig.json --removeComments false",
1112
"test:Unit": "mocha",
1213
"lint": "eslint --max-warnings 0"
1314
},

prod.tsconfig.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
// Override the standard build configurations with the below production ready settings
3+
"compilerOptions": {
4+
/* Visit https://aka.ms/tsconfig to read more about this file */
5+
"sourceMap": false, /* Create source map files for emitted JavaScript files. */
6+
"removeComments": true, /* Disable emitting comments. */
7+
"emitDeclarationOnly": true /* Only output d.ts files and not JavaScript files. */
8+
},
9+
// Ensure that the build output and test folders are not included in the transpiled output
10+
"exclude": [
11+
"test/",
12+
"bin/"
13+
],
14+
// Inherit all of the standard build configurations
15+
"extends": "./tsconfig.json"
16+
}

tsconfig.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@
5151
// "inlineSourceMap": true, /* Include sourcemap files inside the emitted JavaScript. */
5252
// "outFile": "./", /* Specify a file that bundles all outputs into one JavaScript file. If 'declaration' is true, also designates a file that bundles all .d.ts output. */
5353
"outDir": "./bin", /* Specify an output folder for all emitted files. */
54-
"removeComments": true, /* Disable emitting comments. */
54+
// "removeComments": true, /* Disable emitting comments. */
5555
// "noEmit": true, /* Disable emitting files from a compilation. */
5656
// "importHelpers": true, /* Allow importing helper functions from tslib once per project, instead of including them per-file. */
5757
// "importsNotUsedAsValues": "remove", /* Specify emit/checking behavior for imports that are only used for types. */

0 commit comments

Comments
 (0)