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

Support es6/es2015 TypeScript target #219

Closed
AbakumovAlexandr opened this issue Aug 3, 2018 · 7 comments
Closed

Support es6/es2015 TypeScript target #219

AbakumovAlexandr opened this issue Aug 3, 2018 · 7 comments

Comments

@AbakumovAlexandr
Copy link

I'm using "breeze-client + breeze-bridge2-angular in an Angular 6 app. When TypeScript compiler target is es5 everything works fine. When I set it to es6 / es2015 as described in Angular docs, I'm getting an exception at run-time:

Uncaught TypeError: Cannot set property '_$fnName' of undefined
at Object.__config.registerFunction (breeze.debug.js:1850)
at Function.ctor.registerFactory (breeze.debug.js:2401)

I suppose this is because Breeze doesn't support es6 / es2015 target yet.

@AbakumovAlexandr AbakumovAlexandr changed the title Support at least es6/es2015 TypeScript target Support es6/es2015 TypeScript target Aug 3, 2018
@marcelgood
Copy link
Contributor

I won't expect breeze to work with an es6 target. Other third-party libraries may have the same issue. We have rewritten breeze in TypeScript, but haven't released it yet.

Any particular reason you are targeting es6? Targeting es6 will just limit you to which browser the application will run in. TypeScript pretty much gives you all the es6 features, so you can code with modern features, but there is no real good reason to target es6 for the transpiled final output. The TypeScript compiler will transpile all the es6 features to es5 and the final app will run in any browser.

@AbakumovAlexandr
Copy link
Author

AbakumovAlexandr commented Aug 6, 2018

@marcelgood , it's pretty exciting! Would Breeze re-written in TS be open-source as well? Is it available somewhere for the public maybe in beta\alpha phase?

Regarding your other comments.

Any particular reason you are targeting es6?

There are at least 3 reasons:

  1. Significantly smaller final JS modules especially if you're using async`await(which Breeze is promoting by havingPromise`-based API).

  2. Better performance since newer JS features are left for native execution without transpiling them.

  3. Looking at it backwards, the only major browser which doesn't support es6 natively is IE. So if you don't care about supporting it, there is no reason to stay on es5. That section of the Angular docs I've provided above indirectly confirms that Angular perfectly works on es6 browsers, thus encouraging us to make this upgrade.

As to other third-party libraries, they'll inevitably move to es6 (if not done this already). Also, it seems there are no other libraries you use in a typical Angular + Breeze app that doesn't work with es6 target.

@marcelgood
Copy link
Contributor

Yes, it is open source. The source is on Github and you can install it into your app with the following command.

npm install breeze-client@next

https://github.com/Breeze/breeze-client

@marcelgood
Copy link
Contributor

There's also a branch for our TempHire reference app migrated to breeze-client@next if you wanna see what things had to change.

https://github.com/Breeze/temphire.angular/tree/breeze-client%40next

@AbakumovAlexandr
Copy link
Author

@marcelgood I've checked out your proposal to use npm install breeze-client@next which installed 2.0.0-alpha.8 version for me, but the result is still the same.

I've reported it here. Would appreciate if you provided some feedback.

@steveschmitt
Copy link
Member

Just updated breeze-client to 2.0.0-alpha.9, which supports ES6 and Angular 8. Please npm install breeze-client@next and give it a try.

Please note that breeze-client now uses the Angular Package Format, so the paths to the adapters have changed. Please see the README

@steveschmitt
Copy link
Member

The breeze-client package is now released at version 2.0.1

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

No branches or pull requests

3 participants