09-07-2021 21:40
09-07-2021 21:40
I wrote below codes:
// app/mymodule.ts
const a = 0;
let unuseVariable = 1;
const unuseConst = 2;
export const c = a;
export class UnuseClass {
someMethod() {
return unuseConst
}
}// app/index.ts
import {c} from "./mymodule"
console.log(c);
Then I ran `npx tsc app / index.ts`. The following source code was generated.
//mymodule.js
"use strict";
exports.__esModule = true;
exports.UnuseClass = exports.c = void 0;
var a = 0;
var unuseVariable = 1;
var unuseConst = 2;
exports.c = a;
var UnuseClass = /** @class */ (function () {
function UnuseClass() {
}
UnuseClass.prototype.someMethod = function () {
return unuseConst;
};
return UnuseClass;
}());
exports.UnuseClass = UnuseClass;//index.js
"use strict";
exports.__esModule = true;
var mymodule_1 = require("./mymodule");
console.log(mymodule_1.c);
Next, I run `npm run build`. The `index.js` included in` app.fba` is below.
"use strict"
console.log(0)Unlike in `tsc`, unuse variables and class are deleted. And constant have been converted to literal.
Source codes are optimized!
This optimization is nice to me. But I have some questions.
Answered! Go to the Best Answer.
Best Answer09-14-2021 07:05
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
09-14-2021 07:05
There's a lot going on in the build process which is handled by rollup.js. You can take a look at the tooling here https://github.com/Fitbit/fitbit-sdk-toolchain
09-14-2021 07:05
Fitbit Developers oversee the SDK and API forums. We're here to answer questions about Fitbit developer tools, assist with projects, and make sure your voice is heard by the development team.
09-14-2021 07:05
There's a lot going on in the build process which is handled by rollup.js. You can take a look at the tooling here https://github.com/Fitbit/fitbit-sdk-toolchain
09-16-2021 16:51
09-16-2021 16:51
> JonFitbit
https://github.com/Fitbit/fitbit-sdk-toolchain
This is exactly the information I wanted! Thank you!
I wanted to know what was going on with 'fitbit-build'. I can be understand it by looking at this.
As a side note, I found out that `tsc` does not perform any optimization. Only perform the conversion.
Best Answer