Tag: typescript gulp tsify

将打字稿库打包成一个.js文件和一个.d.ts文件

我正在开发一个库,使用TypeScript在网页浏览器中使用。 我正在编写单独的打字稿文件作为模块使用“系统”作为 – 模块,例如这是主要文件: /// <reference path="../typings/tsd.d.ts" /> /// <reference path="./typings/simple-html-tokenizer/simple-html-tokenizer" /> export * from "./Decorators/Component"; export * from "./Decorators/Directive"; export * from "./Decorators/Inject"; export * from "./Decorators/Injectable"; export * from "./Events/EventEmitter"; export * from "./Core/Bootstrap"; export * from "./Decorators/Output"; export * from "./Decorators/Input"; export {OnChanges, OnInit, OnDestroy} from "./Core/LifeCycle/LifeCycleHooks"; 这是第一个模块: import {serviceNormalize} from "../Utils/AngularHelpers"; […]

如何使用browserify从node_modules加载打字稿模块?

当我运行tsc ,一切运行得很好。 但是,我不明白你是如何从节点模块导入其他打印模块的。 这是我的一大堆文件的重要部分: 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是tsmvc模块节点模块,我得到cannot find module tsmvc. primefaces不抱怨,并显示我intellisense,TSC不抱怨,但tsify呢。 任何人都可以指向我做一个类似的吞咽文件或解释过程? 这里的github回购: https : //github.com/Davste93/typescript-mvc-consumer/blob/master/gulpfile.js