Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add tslib #3458

Merged
merged 4 commits into from
Jan 20, 2019
Merged

add tslib #3458

merged 4 commits into from
Jan 20, 2019

Conversation

webleaf
Copy link
Contributor

@webleaf webleaf commented Jan 19, 2019

Since we use `typescript@2.8.1` we can use tslib 1.7.0 or later. Release note for tslib 1.70:
```
NOTE: This is a breaking change from TypeScript 2.3.2 and earlier when using tslib with async generators:

If you are using TypeScript 2.3.2 or earlier and are writing async generators, you must use tslib version 1.6.1.
If you are using TypeScript 2.3.3 or later and are writing async generators, you must use tslib version 1.7.0 or later.
```
@pleerock
Copy link
Member

but users will have to install it as well, right? e.g. they must do importHelpers: true and install tslib in their projects manually, right?

@webleaf
Copy link
Contributor Author

webleaf commented Jan 20, 2019

@pleerock Nope.
importHelpers: true is ts compiler option. So it works only when you make typeorm build. typeorm npm package contains only *.js, .d.ts files and package.json which should contain tslib dependency.
I add it as dependency to package.json (if package.json which I change will be lie in builded typeorm npm package).
So it works as all npm-packages works. When user install typeorm via npm install typeorm it wiil be automatically dowloaded to one of two places:

  • userProject/node_modules/typeorm/node_modules/tslib
  • userProject/node_modules/tslib

To which place it will be automatically placed depends on tslib version of user project (and is it exist in user project or not).
For example this screenshot of my node_modules dir tree (as you can see there are typeorm/node_modules dir with debug and ms dirs which I don't install manually. gray colored icons - installed by me, orange colored icons - automatically installed dependencies):

2019-01-20 9 16 42

@pleerock
Copy link
Member

pleerock commented Jan 20, 2019

ah okay it only adds var tslib_1 = require("tslib"), for some reason I was always thinking it requires a globally included shim-like import.

@pleerock
Copy link
Member

pleerock commented Jan 20, 2019

The only concern I have if mobile-based and browser-based builds will continue to work.

@webleaf
Copy link
Contributor Author

webleaf commented Jan 20, 2019

@pleerock first of all, this feature is important for mobile-based and browser-based builds (reduce package size). I use nativescript, that's why I do this. In the coming hours I will check it one more time and let you know.

@webleaf
Copy link
Contributor Author

webleaf commented Jan 20, 2019

@pleerock works like a charm. Tested with nativescript-vue-typeorm-sample

@pleerock
Copy link
Member

Okay lets try to merge it and see how it works for users.

@pleerock pleerock merged commit ad3eaef into typeorm:master Jan 20, 2019
@webleaf webleaf deleted the webleaf-patch-1 branch January 20, 2019 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants