Skip to content

Commit 856e4ba

Browse files
bors[bot]Veetaha
andauthored
Merge #2979
2979: vscode: now we are actually using tslib r=matklad a=Veetaha We had an incorrect setup where `tslib` was in `devDependencies`. FYI: tslib is a runtime dependency, it contains functions that are used by transpiled JavaScript in order not to inline them in each file. For example: ```ts // foo.ts (source code) import * as foo from "foo"; // --------------------------- // foo.js (compiled output) "use strict"; var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k]; result["default"] = mod; return result; }; Object.defineProperty(exports, "__esModule", { value: true }); const foo = __importStar(require("foo")); ``` As you see, `tsc` generated that `__importStar` helper function in compiled output. And it generates it per each file if you don't enable `"importHelpers": true`. Now with `importHelpers` enabled we get the following picture: ```ts // foo.ts (source code) import * as foo from "foo"; // --------------------------- // foo.js (compiled output) "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const tslib_1 = require("tslib"); const foo = tslib_1.__importStar(require("foo")); ``` It saves some bundle size, but I am not entirely sure wheter we want that. Discussions are welcome! Co-authored-by: Veetaha <gerzoh1@gmail.com>
2 parents 9006cec + f082979 commit 856e4ba

File tree

3 files changed

+4
-4
lines changed

3 files changed

+4
-4
lines changed

editors/code/package-lock.json

Lines changed: 1 addition & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

editors/code/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,8 @@
2626
"dependencies": {
2727
"jsonc-parser": "^2.1.0",
2828
"seedrandom": "^3.0.5",
29-
"vscode-languageclient": "^6.1.0"
29+
"vscode-languageclient": "^6.1.0",
30+
"tslib": "^1.10.0"
3031
},
3132
"devDependencies": {
3233
"@rollup/plugin-commonjs": "^11.0.1",
@@ -36,7 +37,6 @@
3637
"@types/seedrandom": "^2.4.28",
3738
"@types/vscode": "^1.41.0",
3839
"rollup": "^1.30.1",
39-
"tslib": "^1.10.0",
4040
"tslint": "^5.20.1",
4141
"typescript": "^3.7.5",
4242
"typescript-formatter": "^7.2.2",

editors/code/tsconfig.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"noFallthroughCasesInSwitch": true,
1616
"newLine": "LF",
1717
"esModuleInterop": true,
18+
"importHelpers": true
1819
},
1920
"exclude": [
2021
"node_modules"

0 commit comments

Comments
 (0)