本文整理汇总了TypeScript中@hpcc-js/requirejs-shim.require.config方法的典型用法代码示例。如果您正苦于以下问题:TypeScript require.config方法的具体用法?TypeScript require.config怎么用?TypeScript require.config使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类@hpcc-js/requirejs-shim.require
的用法示例。
在下文中一共展示了require.config方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: dev
export function dev(additionalPaths: { [key: string]: string } = {}): any {
window.__hpcc_topoJsonFolder = `${hostUrl}/map/TopoJSON`;
const thirdPartyPaths: { [key: string]: string } = {};
for (const key in npmPackages) {
thirdPartyPaths[key] = `${hostUrl}/../node_modules/${npmPackages[key]}`;
}
const paths: { [key: string]: string } = {
...thirdPartyPaths,
...additionalPaths
};
const rjsPackages: any = [];
hpccShims.forEach(shim => {
paths[`@hpcc-js/${shim}`] = `${hostUrl}/${shim}/dist/index`;
});
packages.forEach(pckg => {
paths[`@hpcc-js/${pckg}`] = `${hostUrl}/${pckg}`;
rjsPackages.push({
name: `@hpcc-js/${pckg}`,
main: "lib-umd/index"
});
});
return requirejs.config({
context: hostUrl,
paths,
packages: rjsPackages,
shim: requireShims
});
}
示例2: reqListener
function reqListener() {
const pkg = JSON.parse(this.responseText);
console.log(`Configuring require from ${pkg.name}@${pkg.version} from ${url}`);
const topoJsonUrl = `${pkgUrl(pkg, "@hpcc-js/map")}/TopoJSON`;
window.__hpcc_topoJsonFolder = topoJsonUrl;
const paths: { [key: string]: string } = {
"@hpcc-js/map/TopoJSON": topoJsonUrl,
...additionalPaths
};
for (const key in pkg.dependencies) {
paths[key] = `${pkgUrl(pkg, key)}/dist/index${minStr}`;
}
resolve(requirejs.config({
context: url,
paths
}));
}
示例3: cdn
export function cdn(url: string, min: boolean = true, additionalPaths: { [key: string]: string } = {}): any {
console.log("Deprecated - please use 'amd'");
window.__hpcc_topoJsonFolder = `${url}/map/TopoJSON`;
const minStr = min ? ".min" : "";
const paths: { [key: string]: string } = {
"@hpcc-js/map/TopoJSON": `${url}/map/TopoJSON`,
...additionalPaths
};
hpccShims.forEach(shim => {
paths[`@hpcc-js/${shim}`] = `${url}/${shim}/dist/index${minStr}`;
});
packages.forEach(pckg => {
paths[`@hpcc-js/${pckg}`] = `${url}/${pckg}/dist/index${minStr}`;
});
return requirejs.config({
context: url,
paths
});
}