我正在尝试将 TS 编译包含到我的项目中。这是我的 tsconfig.json:
{
"compilerOptions": {
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"module": "system",
"moduleResolution": "node",
"noImplicitAny": false,
"outDir": "build/develop/assets/scripts",
"removeComments": false,
"rootDir": "assets/management/",
"sourceMap": false,
"target": "ES5"
},
"exclude": [
"node_modules"
]
}
这是我的 tasks/config/ts.js 文件:
/**
* Compile TS files to JS.
*
* @see https://github.com/TypeStrong/grunt-ts
*/
module.exports = function (grunt) {
grunt.config.set('ts', {
angular_app_dev: {
default: {
// src: [
// "assets/management/**/*.ts",
// "!node_modules/**/*.ts" // Avoid compiling TypeScript files in node_modules
// ],
// outDir: "assets/vili2",
tsconfig: {
tsconfig: true,
ignoreFiles: false,
ignoreSettings: false,
overwriteFilesGlob: false,
updateFiles: true,
passThrough: false
}
// options: {
// module: 'commonjs',
// // To compile TypeScript using external modules like NodeJS
// fast: 'never'
// // You'll need to recompile all the files each time for NodeJS
// }
}
}
});
grunt.loadNpmTasks('grunt-ts');
};
我正在尝试使它编译TS文件(稍后我想添加一个手表,以便每次更改它们时都会编译它们,但一次只做一件事)
当我从命令行运行“tsc”时,它可以完美运行,但是如果我运行
grunt ts:angular_app_dev -verbose
它产生这个:
$ grunt ts:angular_app_dev -verbose
Initializing
Command-line options: --verbose
Reading "Gruntfile.js" Gruntfile...OK
Registering Gruntfile tasks.
Registering "grunt-contrib-clean" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-clean\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-clean\package.json...OK
Loading "clean.js" tasks...OK
+ clean
Registering "grunt-contrib-coffee" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-coffee\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-coffee\package.json...OK
Loading "coffee.js" tasks...OK
+ coffee
Registering "grunt-contrib-concat" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-concat\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-concat\package.json...OK
Loading "concat.js" tasks...OK
+ concat
Registering "grunt-contrib-copy" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-copy\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-copy\package.json...OK
Loading "copy.js" tasks...OK
+ copy
Registering "grunt-contrib-cssmin" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-cssmin\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-cssmin\package.json...OK
Loading "cssmin.js" tasks...OK
+ cssmin
Registering "grunt-contrib-jst" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-jst\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-jst\package.json...OK
Loading "jst.js" tasks...OK
+ jst
Registering "grunt-contrib-less" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-less\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-less\package.json...OK
Loading "less.js" tasks...OK
+ less
Registering "grunt-sails-linker" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-sails-linker\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-sails-linker\package.json...OK
Loading "scriptlinker.js" tasks...OK
+ sails-linker
Registering "grunt-sync" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-sync\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-sync\package.json...OK
Loading "sync.js" tasks...OK
+ sync
Registering "grunt-ts" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-ts\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-ts\package.json...OK
Loading "ts.js" tasks...OK
+ ts
Registering "grunt-contrib-uglify" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-uglify\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-uglify\package.json...OK
Loading "uglify.js" tasks...OK
+ uglify
Registering "grunt-contrib-watch" local Npm module tasks.
Reading D:\Work\...\...\node_modules\grunt-contrib-watch\package.json...OK
Parsing D:\Work\...\...\node_modules\grunt-contrib-watch\package.json...OK
Loading "watch.js" tasks...OK
+ watch
Loading "Gruntfile.js" tasks...OK
+ build, buildProd, compileAssets, db:migrate, default, linkAssets, linkAssetsBuild, linkAssetsBuildProd, prod, prodTest, syncAssets
Running tasks: ts:angular_app_dev
Running "ts:angular_app_dev" (ts) task
Verifying property ts.angular_app_dev exists in config...OK
File: [no files]
Done, without errors.
我错过了什么???