Reputation: 1022
I'm trying to build the TypeScript project here as
git clone https://github.com/simpleledger/BitcoinFilesJS.git test/
cd test
npm i
tsc # or npx tsc
The index.js
created is this:
"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, if I install the project as in a new directory with npm i bitcoinfiles
, the index.js is:
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 my unclean index.js? In addition, they don't work. As you can see, the unclean index.js
doesn't define module.exports
Upvotes: 0
Views: 1055
Reputation: 3321
I just recreated the index.js successfully from a checkout of the release-tagged code at https://github.com/simpleledger/BitcoinFilesJS/tree/0.5.0 by running npm run build
let bfp = require('./lib/bfp');
let utils = require('./lib/utils');
let network = require('./lib/network');
module.exports = {
bfp: bfp,
utils: utils,
network: network
}
Be aware that the main/master branch of any repo might be where work is going on, and released versions could be different. Currently the main branch of this repo seems to target ES5 which transpiles differently.
Currently this only builds successfully by manually creating the dist
directory and probably requires manual install of typescript
and browserify
which I guess is just installed globally in the authors machine so they didn't realise they were missing these dependencies.
Upvotes: 1