This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
Configuration files motivation
Floris Bernard edited this page Aug 3, 2016
·
3 revisions
On this page you can find a detailed explanation for the motivation behind each configuration file.
See Travis for more information
The boilerplate contains 3 variations for the typescript tsconfig.json file.
- /tsconfig.json The default configuration that will be used in npm/es6 builds
- /config/tsconfig.webpack.json Alternative configuration that will be used when building umd, amd, commonjs2, browser and systemjs using webpack
- /config/tsconfig.test.json Alternative configuration that will be used when compiling through webpack and karma when running unit tests
-
compilerOptions.module: "commonjs"
We compile to commonjs modules because this is the most commonly used system when publishing to NPM. For es6 output, we overwrite this value using the-m es6
compiler argument. -
compilerOptions.moduleResolution: "node"
Allows us to easily import dependencies from the node_modules folder -
compilerOptions.target: "es5"
We target es5 for backwards compatibility. For es6 output, we overwrite this value using the-t es6
compiler argument -
compilerOptions.emitDecoratorMetadata: true
(todo) -
compilerOptions.experimentalDeccorators: true
Allows us to use ES7 decorator syntax -
compilerOptions.preserveConstEnums: true
Our enums will often be used from the outside (by applications that import this module). This option will prevent the enums from being excluded in the output. -
compilerOptions.noImplicitAny: false
(todo) -
compilerOptions.removeComments: false
(todo)
-
compilerOptions.sourceMap: false
andcompilerOptions.inlineSourceMap: false
We only want source maps for development of our module, not in the final builds. -
compilerOptions.outDir: "./"
Compile all files to the repository root. Because all files inside our src directory are in a lib subfolder, the compiled files will be placed in /lib -
files: ["./typings/index.d.ts", "./src/index/ts", "./src/lib/Dummy.ts"]
(todo) should we add Dummy.ts to our /src/index.ts instead?
-
compilerOptions.sourceMap: false
We only want to include inline source maps -
compilerOptions.inlineSourceMap: true
We include inline sourcemaps to allow remap-istanbul and karma-sourcemap-support to map code coverage and unit testing errors back to our original Typescript source files, rather than showing line numbers that correspond to compiled javascript. -
files: ["typings/index.d.ts"]
We want to include the definitions file on all our source code. We don't include entry files for our source code itself, because karma will already compile our test files individually though webpack. See our karma and webpack configurations on this page for more information.
-
compilerOptions.sourceMap: false
andcompilerOptions.inlineSourceMap: false
We only want source maps for development of our module, not in the final builds. -
compilerOptions.outDir: "./"
Compile all files to the repository root. Because all files inside our src directory are in a lib subfolder, the compiled files will be placed in /lib -
files: ["./typings/index.d.ts"]
We want to include the definitions file on all our source code. We don't include entry files for our source code itself, because webpack will already compile each source file individually. When we do add the entry files here, it will result in duplicate JS output. See the webpack configuration on this page for more information.