【发布时间】:2016-02-29 18:20:08
【问题描述】:
当我运行tsc 时,一切运行良好。但是,我无法理解您打算如何从节点模块导入其他打字稿模块。
这是我的 gulp 文件的重要部分:
gulp.task('compile-ts', ['clean'], function(){
var sourceTsFiles = [
config.allTs,
config.typings
];
var bundler = browserify({
basedir : "src",
debug : true})
.add("app.ts")
//.add("typings/tsd.d.ts")
.plugin(tsify);
return bundler.bundle()
.pipe(source("bundle.js"))
.pipe(gulp.dest("build"))
.pipe(buffer())
.pipe(sourcemaps.init({loadMaps: true}))
.pipe(sourcemaps.write({includeContent: false, sourceRoot: 'src'}));
});
当我使用时,
import {DataRepository, List} from "tsmvc";
tsmvc 是一个打字稿模块节点模块,我得到cannot find module tsmvc. Atom 不会抱怨并显示智能感知,tsc 不会抱怨,但 tsify 会。
谁能指出我做类似事情的 gulp 文件或解释这个过程?
这里是 github 仓库:https://github.com/Davste93/typescript-mvc-consumer/blob/master/gulpfile.js
【问题讨论】:
-
似乎是这里描述的问题:github.com/TypeStrong/tsify/issues/60 - 无法理解那里的解决方案。
标签: javascript node.js typescript gulp tsify