本文整理汇总了TypeScript中systemjs-builder.config函数的典型用法代码示例。如果您正苦于以下问题:TypeScript config函数的具体用法?TypeScript config怎么用?TypeScript config使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了config函数的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: Builder
gulp.task('!bundle', ['!build:system'], () => {
var builder = new Builder();
builder.config({
map: {
'worker': 'dist/src',
'@angular': 'node_modules/@angular',
'rxjs': 'node_modules/rxjs',
'reflect-metadata': 'node_modules/reflect-metadata/temp/Reflect.js',
'jshashes': 'node_modules/jshashes/hashes.js'
},
packages: {
'worker': {
defaultExtension: 'js'
},
'rxjs': {
defaultExtension: 'js'
},
'@angular/core': {
defaultExtension: 'js',
main: 'index.js'
},
'reflect-metadata': {
format: 'global'
}
}
});
builder.buildStatic('worker/browser_entry', 'dist/worker.js');
});
示例2: Builder
export = (done: any) => {
const options = {
normalize: true,
runtime: false,
sourceMaps: true,
sourceMapContents: true,
minify: true,
mangle: false
};
const builder = new Builder('./');
builder.config({
paths: {
'n:*': 'node_modules/*',
'rxjs/*': 'node_modules/rxjs/*.js',
},
map: {
'rxjs': 'n:rxjs',
},
packages: {
'rxjs': {main: 'Rx.js', defaultExtension: 'js'},
}
});
builder.bundle('rxjs', 'node_modules/.tmp/Rx.min.js', options)
.then(() => done())
.catch((error: any) => done(error));
};
示例3: Builder
module.exports = () => {
const options = {
'normalize': true,
'runtime': false,
'sourceMaps': true,
'sourceMapContents': false,
'minify': true,
'mangle': false
};
const builder = new Builder('./');
builder.config({
'paths': {
'n:*': 'node_modules/*',
'rxjs/*': 'node_modules/rxjs/*.js',
'rxjs/internal-compatibility': 'node_modules/rxjs/internal-compatibility/index.js',
'rxjs/testing': 'node_modules/rxjs/testing/index.js',
'rxjs/ajax': 'node_modules/rxjs/ajax/index.js',
'rxjs/operators': 'node_modules/rxjs/operators/index.js',
'rxjs/webSocket': 'node_modules/rxjs/webSocket/index.js',
},
'map': {
'rxjs': 'n:rxjs'
},
'packages': {
'rxjs': { 'main': 'index.js', 'defaultExtension': 'js' }
}
});
return builder.bundle('rxjs/index.js + ' +
'rxjs/operators/index.js + ' +
'rxjs/internal-compatibility/index.js + ' +
'rxjs/testing/index.js + ' +
'rxjs/ajax/index.js + ' +
'rxjs/webSocket/index.js',
'node_modules/.tmp/Rx.min.js', options)
.then((output: any) => {
const writeFile = promisify(fs.writeFile);
const code = output.source.replace(/rxjs\/index/gm, 'rxjs');
return writeFile('node_modules/.tmp/Rx.min.js',
(options.sourceMaps)
? code + `\n//# sourceMappingURL=Rx.min.js.map`
: code);
});
};
示例4: Builder
gulp.task('task:worker:bundle', done => {
var builder = new Builder();
builder.config({
map: {
'worker': 'dist/src/worker',
'rxjs': 'node_modules/rxjs',
'jshashes': 'node_modules/jshashes/hashes.js'
},
packages: {
'worker': {
defaultExtension: 'js'
},
'rxjs': {
defaultExtension: 'js'
}
}
});
builder
.buildStatic('worker/browser_entry', 'dist/worker.js')
.then(() => done());
});
示例5: function
gulp.task('build-ts', function () {
var opts = {
basedir: config.paths.app,
debug: true
};
var builder = new Builder;
builder.config({
baseUrl: './',
defaultJSExtensions: false,
transpiler: 'typescript',
map: {
typescript: 'node_modules/typescript/lib/typescript.js'
//typescript: 'node_modules/plugin-typescript/lib/plugin.js'
},
packages: {
"modules": {
"main": "main",
"defaultExtension": "ts",
"meta": {
"*.ts": {
"loader": "typescript"
}
}
}
}
});
builder.buildStatic('./main.ts', './main.js', { minify: false, sourceMaps: false })
.then(function () {
console.log('Build complete');
})
.catch((err: any) => {
console.log('Build error');
console.log(err);
});
});