frankwallis / plugin-typescript

TypeScript loader for SystemJS
MIT License
248 stars 47 forks source link

The hot-reloading of example angular1 not working #168

Open kimljj opened 8 years ago

kimljj commented 8 years ago

I would like to have a project with angular1, hot-reloading and typescript. I googled a lof, but didn't found any good examples.

I tried the your example projects, angular2 works, but angular1 not.

I got typings problem with jquery.

could you plz give a working standalone example, not have dependency with your main project

Thanks a lot!

ryanhyslop commented 8 years ago

A quick patch to get the angular 1 version was to add the typings to the map in jspm.config.js

"@types/jquery": "npm:@types/jquery@2.0.33",

Despite the application running after this however the hot reloading doesn't seem to take effect. It makes the request for the module in the network, doesn't throw any errors, in the sources pain of the dev tools the code has updated. It just doesn't seem to take any effect. I got here experiencing similar issues on our own project and wanted to check the example.

Works fine for the angular 2 example. Happy to provide a bit more debugging information if anyone has a good idea where to start...

Further to this the __unload hook does fire on a module, however the __reload hook never seems to fire for anything other than the index.ts file.

aluanhaddad commented 8 years ago

Are you working off of this example? https://github.com/capaj/NG6-starter/blob/eb988ef00685390618b5dad57635ce80c6d52680/client/app/app.js

ryanhyslop commented 8 years ago

I was working off the angular 1 example in this repo ( https://github.com/frankwallis/plugin-typescript/tree/master/examples/angular ). Thanks for pointing me towards that example however its quite helpful. Still wrapping my head round this.

I was bootstrapping the application without the directive, but I guess the missing step was to destroy and re-append the raw DOM on unloading the root module? Which may fill in the gap of my understanding which was previously filled with 'Magic Happens Here' :)

aluanhaddad commented 8 years ago

Unfortunately, I haven't tested it. Angular 1 makes hot reloading difficult. Even in Angular 2 where it is actually supported, I don't find it to be a reliable workflow.