jdanyow / aurelia-breeze

Everything you need to use Breeze with Aurelia
MIT License
63 stars 14 forks source link

aurelia-breeze, typescript (and webpack) #39

Open apawsey opened 7 years ago

apawsey commented 7 years ago

I have tried everything I can think of and cannot get aurelia-breeze, breeze and typescript to play together. I've tried re-editing the type definitions and all sorts... I just always end up with errors along the lines of... node_modules/breeze-client/breeze.debug".export=' has no exported member 'EntityManager'.

Also my understanding is that I need to still use the webpack alias fix, but... if I do that I have to reference the import as breeze (instead of the real breeze-client), and then typescript can no longer find it...

Pulling my hair out here... any help greatly appreciated!

Vaccano commented 7 years ago

I just got this working. (And it took a fair amount of my hair too!) I have been working on this for a while, so I am not sure exactly all that I did.

The two things I can remember are:

  1. Install the Typings from Definitely Typed using typings install dt~breeze --global
  2. Add this to my main.ts before the configure function: require('expose?breeze!breeze-client/breeze.debug');

You still need to have the normal .plugin('aurelia-breeze') as part of your aurelia.use.

flieks commented 7 years ago

@apawsey did you get it to work? I have problems after upgrading aurelia (from RC to 1.0.0). But i think it's typescript 2.0 maybe. With TS 1.8 it worked fine.

apawsey commented 7 years ago

Hey guys... sorry somehow missed the notifications for these replies!

No I didn't get it to work, until... @Vaccano's require('expose?breeze!breeze-client/breeze.debug') tip...

It seems in my case that the typescript/babel/webpack combination (no idea whose responsible at this point) doesn't generate require statements in the end output for things imported via a namespace in typescript. I say this because with internal code I had exactly the same issue. So it seems that this expose tip is getting around it by simply making breeze a global variable, when it actually shouldn't really be.