alexisvincent / systemjs-hot-reloader

reloads your modules as needed so that you can have satisfyingly fast feedback loop when developing your app
MIT License
228 stars 36 forks source link

Previous module state lost when reloading html via plugin-text twice #100

Closed svi3c closed 7 years ago

svi3c commented 8 years ago

Hello,

I'm encountering an error when I do two changes to html files:

Module "http://localhost:9987/src/main.dev.ts" reimport failed because this error was thrown:  TypeError: Cannot read property 'storeHolder' of undefined
    at r.__reload (http://localhost:9987/src/main.dev.ts!transpiled:76:18)
    at eval (http://localhost:9987/jspm_packages/github/capaj/systemjs-hot-reloader@0.6.0/hot-reloader.js!transpiled:263:36)
    at ZoneDelegate.invoke (http://localhost:9987/.tmp/dev-bundle.js:71876:153)
    at Zone.run (http://localhost:9987/.tmp/dev-bundle.js:71771:41)
    at eval (http://localhost:9987/.tmp/dev-bundle.js:72109:55)
    at ZoneDelegate.invokeTask (http://localhost:9987/.tmp/dev-bundle.js:71901:164)
    at Zone.runTask (http://localhost:9987/.tmp/dev-bundle.js:71813:43)
    at drainMicroTaskQueue (http://localhost:9987/.tmp/dev-bundle.js:72013:29)
    at XMLHttpRequest.ZoneTask.invoke (http://localhost:9987/.tmp/dev-bundle.js:71965:17)

You may reproduce it on this branch: https://github.com/flaviait/ng2-jspm-template/tree/ts2-templates.

The problem only ocurrs when changing an html template two times. You can do changes in other files (even other html files) in between, but when you change the same template the second time, the parameter passed to the __reload() function in the root module is undefined.

After this issue ocurrs, it ocurrs repeatedly on any file change until you reload the page.

Any idea what is going on here?

Thanks in advance! :-)

alexisvincent commented 7 years ago

If you're still experiencing this please submit a PR with a failing test case to alexisvincent/systemjs-hmr