Javascript 在gulpfile中使用SystemJS模块
我想知道是否可以在gulp配置文件Javascript 在gulpfile中使用SystemJS模块,javascript,visual-studio,typescript,gulp,systemjs,Javascript,Visual Studio,Typescript,Gulp,Systemjs,我想知道是否可以在gulp配置文件gulpfile.js中使用SystemJS模块。这是因为我想用TypeScript来写gulpfile,因为这会给我智能感知 我已经建立了一个VisualStudio2015项目,它使用TypeScript作为传输工具,使用SystemJS作为模块加载器。我的TypeScript文件由Visual Studio编译。为此,我添加了一个带有以下设置的tsconfig.json文件: { "compilerOptions": { ... "ta
gulpfile.js
中使用SystemJS模块。这是因为我想用TypeScript来写gulpfile,因为这会给我智能感知
我已经建立了一个VisualStudio2015项目,它使用TypeScript作为传输工具,使用SystemJS作为模块加载器。我的TypeScript文件由Visual Studio编译。为此,我添加了一个带有以下设置的tsconfig.json
文件:
{
"compilerOptions": {
...
"target": "es5",
"module": "system"
},
...
}
现在我想向项目中添加Gulp,并用TypeScript编写gulpfile。我创建了一个gulpfile.ts并导入了TypeScript定义文件。这是gulpfile.ts
:
import * as gulp from 'gulp';
gulp.task('default', () => {
console.log('hello from gulp');
});
这是编译的gulpfile.js
的第一行:
System.register(['gulp'], function(exports_1, context_1) {
当然,使用了System
,因为这是我在tsconfig.json
中配置的模块加载器。在命令提示符下运行gulp时,出现以下错误:
ReferenceError:未定义系统
反对。(gulpfile.js:1:63)
我的问题:有没有办法让gulp接受SystemJS模块,这样我就可以用TypeScript编写gulpfile,同时保持系统作为模块加载器(至少在项目的其余部分)