Attempting to consolidate multiple TypeScript files into a single file for faster browser loading during browser based TDD. The primary index.ts file can be found here.
export * from "./xrm-mock/index";
export { XrmMockGenerator } from "./xrm-mock-generator/index";
Originally there were two separate libraries, xrm-mock and xrm-mock-generator, but it was decided to merge them into one using the above file.
Referencing this project via npm was causing slow loading times when using StealJs to load the files in unit tests with Karma. The solution involved bundling all files into a single file.
Used the following build script:
tsc --outFile ./build/build.js --module amd
The root module name defaulted to "index" in the built single file:
define("index", ["require", "exports", "xrm-mock/index", "xrm-mock-generator/index"], function (require, exports, xrmMock, index_1) {
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.xrmMock = xrmMock;
exports.XrmMockGenerator = index_1.XrmMockGenerator;
});
The intention was to default it to "xrm-mock".
Is there a way to instruct TypeScript to transpile the name as "xrm-mock" instead of index.ts?
If not, what would be the simplest automated method for editing the file (both the "js" and "d.ts") post-build to replace "index" with "xrm-mock"?