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

Recovery from SystemJS error #139

Closed
ArmorDarks opened this issue Mar 17, 2017 · 17 comments
Closed

Recovery from SystemJS error #139

ArmorDarks opened this issue Mar 17, 2017 · 17 comments

Comments

@ArmorDarks
Copy link

Is it possible to somehow automatically recover from SystemJS error?

For example, if there were a typo in imported file, we've got following error:

Error: (SystemJS) http://localhost:3000/source/scripts/main.js: Unexpected token (18:6)
	  16 |     return React.createElement('div', null, [
	  17 |       React.createElement('div', null, 'test')
	> 18 |       React.createElement(Second, null, null)
	     |       ^
	  19 |     ])
	  20 |   }
	  21 | }

Hot reloading not working after this error until whole page will be reloaded, which takes quite a lot of time for large apps.

@alexisvincent
Copy link
Owner

Recovery is actually built into systemjs-hot-reloader. Which version are you running?

@alexisvincent
Copy link
Owner

Potentially the only thing we don't account for is if importing fails on the very first load of the app. But after that it should recover.

@ArmorDarks
Copy link
Author

Hm, in my case nothing happens after hitting syntax error. Chokidar emits change event on change, but hot-reloader does not react on changes until full page refresh.

@alexisvincent
Copy link
Owner

alexisvincent commented Mar 17, 2017

Which version are you running. Also what is the output after enabling systemjs-hmr debug. (localStorage.debug = "systemjs-hmr:*" in console). Including a refresh

@ArmorDarks
Copy link
Author

I'm using system-hot-reloader 1.1.0

Also what is the output after enabling systemjs-hmr debug. (localStorage.debug = "systemjs-hmr:*" in console)

That's displayed right after the load:

1smr5u

This is on reload:

3

This is after cleaning console and introducing syntax error (I removed , in array):

2

And when I remove error and resave file, shows:

1

Same message will be on all other attempts to resave without reloading whole page:

last

@alexisvincent
Copy link
Owner

Hmm, which version of SystemJS are you running? There was a bug with the old version of SystemJS.

Also, notice the warning at the top. You need to load systemjs-hot-reloader after SystemJS itself has run.

@ArmorDarks
Copy link
Author

Wow, I didn't notice that JSPM beta.41 already came out yesterday... my SystemJS indeed was old, now I've updated to v0.20.10 Dev.

This fixed a lot of issues, but particular case with syntax error still there. But now it behaves differently:

On error introduction:

1111

And when error has been fixed, it keep showing like it still exist:

222

Any attempts to resave file with fixed error will just show again messages from last screenshot.

Also, notice the warning at the top. You need to load systemjs-hot-reloader after SystemJS itself has run.

Well, I'm quite sure that I do load it after SystemJS, but it still shows up.

My configuration:

sublime_text_2017-03-17_14-46-52

Don't mind @ in the beginning. Those are just mapping for Browser Sync routes, so that it could serve files properly (our files served not from same directory as jspm):

sublime_text_2017-03-17_14-48-20

@peteruithoven
Copy link
Contributor

I'm also experiencing this issue. I've tried to make a simple example:
https://github.com/peteruithoven/hot-reloader-error-recovery

@alexisvincent
Copy link
Owner

Thanks, will sort this out this weekend. Have a deadline for Friday evening 🍕

@ArmorDarks
Copy link
Author

I actually found out that workflow with this hot reloader much more enjoyable than with jspm build --watch even with this issue in-place, so I'm sold out anyway

@alexisvincent
Copy link
Owner

Apologies that I haven't been present. Have major deadlines for Friday. Will be pushing forwards next week.

@ArmorDarks
Copy link
Author

No need for that, it isn't your work after all!

@kanoshin
Copy link

@alexisvincent sorry for bothering. This bug seriously interrupts development :(. Have you been able to fix it? Do you need help to fix it?

@isitrita
Copy link

isitrita commented Jun 2, 2017

Hi, @alexisvincent , I would also love to see this thing to be fixed! Fix for this issue will make development much less painful

@alexisvincent
Copy link
Owner

Sorry guys, been in a heavy deadline crunch for the past couple of months. Going to try get a look at this in the coming week or so.

@kanoshin
Copy link

kanoshin commented Jun 17, 2017

@alexisvincent after recent system.js update hot reload is able to recover from transpilation errors. I think you can close this bug.

@ArmorDarks
Copy link
Author

Yeap, seems so.

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

5 participants