Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/367.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 如果使用子任务,Grunt不会编译代码_Javascript_Gruntjs_Typescript - Fatal编程技术网

Javascript 如果使用子任务,Grunt不会编译代码

Javascript 如果使用子任务,Grunt不会编译代码,javascript,gruntjs,typescript,Javascript,Gruntjs,Typescript,我不太会使用Grunt:)我有研究文档,发现了一个非常有趣的问题。 如果我的任务定义如下: typescript: { options: { target: 'es5', expand: true }, base: { src: ['src/main/webapp/**/*.ts'], dest:

我不太会使用Grunt:)我有研究文档,发现了一个非常有趣的问题。 如果我的任务定义如下:

    typescript: {
         options: {
                target: 'es5',
                expand: true
            },
            base: {
                src: ['src/main/webapp/**/*.ts'],
                dest: ''
            }
    }
    grunt.registerTask('compile', ['typescript']);
一切都很好。但是如果我想指定目标,有更多的构建阶段,那么我编写如下代码:

     typescript: {
        dev: {
            options: {
                target: 'es5',
                expand: true
            },
            base: {
                src: ['src/main/webapp/**/*.ts'],
                dest: ''
            }
        }
     }
     grunt.registerTask('compile', ['typescript:dev']);
没有发生错误,但TS文件未编译为JS文件,因为grunt未找到任何TS文件。我真的不知道,我做错了什么


有什么想法吗?:)请……我真的很绝望:(

看一下这些建议,子任务可能不适用于此模块。

快速看一下这些建议,子任务可能不适用于此模块。你真是天才!我认为,Grundfile的结构取决于Grunt而不是插件…非常好的主意!请写下你的评论作为答案,然后我会检查答案正确:)@Xrew
grunt ts
支持子任务很好:是的,我知道,这是@Andy写信给我后我尝试的下一个选项,Tyepscript不起作用。:)但是非常感谢您的时间@巴萨拉特,谢谢你的信息。