What I have:
./src/myfile.ts
./test/mytest.spec.ts
And tsc should create a javascript ( myfile.js
) and definition file ( myfile.d.ts
) in the ./build
location.
My tsconfig.ts:
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"noImplicitAny": false,
"rootDir": ".",
"outDir": "./build",
"sourceMap": true,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"moduleResolution": "node",
"declaration": true
},
"files": [
"./src/index.ts"
],
"exclude": [
".vscode",
".git",
"build",
"node_modules",
"test"
],
"compileOnSave": false,
"buildOnSave": false,
"atom": {
"rewriteTsconfig": false
}
}
But this config file generates the myfile.js
in the ./build/src/
sub-folder.
Note that I cannot use "rootDir": "./src"
because then the test folder is not compiled (which gives problems when running tests with karma + webpack?)
And tsc should create a javascript (myfile.js) and definition file (myfile.d.ts) in the ./build location.
TypeScript is not nicely modeled to handle bundling . That is something you should use some other tool to do
eg Webpack quickstart: https://basarat.gitbooks.io/typescript/content/docs/quick/browser.html
Don't recommend out
/ outFile
: https://basarat.gitbooks.io/typescript/content/docs/tips/outFile.html
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.