Looking to set up the TypeScript project here. The steps are:
git clone https://github.com/simpleledger/BitcoinFilesJS.git test/
cd test
npm i
tsc # or npx tsc
The resulting index.js
is shown below:
"use strict";
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
}) : (function(o, m, k, k2) {
if (k2 === undefined) k2 = k;
o[k2] = m[k];
}));
var __exportStar = (this && this.__exportStar) || function(m, exports) {
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
};
Object.defineProperty(exports, "__esModule", { value: true });
__exportStar(require("./lib/bfp"), exports);
__exportStar(require("./lib/utils"), exports);
//# sourceMappingURL=index.js.map
However, when installing the project with npm i bitcoinfiles
in a new directory, the content of index.js changes:
let bfp = require('./lib/bfp');
let utils = require('./lib/utils');
let network = require('./lib/network');
module.exports = {
bfp: bfp,
utils: utils,
network: network
}
What could be causing TypeScript to generate the unexpected index.js file? Moreover, the functionality seems to be affected since the altered index.js
is missing the definition of module.exports
.