diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-02-02 14:05:23 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-02-02 14:05:23 +0000 |
commit | 856e4ba126ae776753f38c00593c02c4f43be510 (patch) | |
tree | 94671175f90d50e215b6ead77de44fd8a39d3f8e /crates/ra_text_edit/src | |
parent | 9006cec4928a28e4b70f536fc740fad5e82319d1 (diff) | |
parent | f08297983faac35e0b0fd475bc935ba0bc0726cb (diff) |
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 <[email protected]>
Diffstat (limited to 'crates/ra_text_edit/src')
0 files changed, 0 insertions, 0 deletions