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

Source map problems #127

Closed
milankinen opened this issue Sep 16, 2016 · 8 comments
Closed

Source map problems #127

milankinen opened this issue Sep 16, 2016 · 8 comments

Comments

@milankinen
Copy link
Owner

Continuing from #123 (comment)

@sassanh wrote:
I don't know if it's related to this issue, I don't know if it's specific to my setup too. When I use livereactload with -d it ruins the sourcemaps a little bit, there are 2 problems:

  1. files with same name override each other: if I have two files with name reducer.js and if an error occurs in first file, if I click on the location chrome shows in the error traceback (reducer.js:40 for example) it may go to the other reducer.js. It doesn't change in a single load of page, but after each reload it's random.
  2. Lines are slightly changed, for example it shows the error happened in line reducer.js:40 but it really happened in line 36 for example. It's always a few lines but sometime I need to re compile code without livereactload to be able to debug.

Another thing that seems weird and may be related is that my bundle is around 7.5MB without livereactload but with livereactload the size reduces to around 6MB.

I just thought maybe these are also related to this thread. Let me know if I should create another issues for these and if I should provide additional information :)

Hmmm, okay... I know there have been some problems with source maps from the very beginning (#2 and #106) but I have no idea how to fix them. Any help/suggestions are warmly welcomed!

@sergiu-paraschiv
Copy link

Found out that [ babelify --sourceMapsAbsolute ] solves problem number (1) listed above.
Line numbers are still off.

@sassanh
Copy link

sassanh commented Oct 11, 2016

@sergiu-paraschiv Great finding. I guess with --sourceMapsAbsolute I don't need recompiling code without livereactload in case of complex bugs, because the line reported is usually close to the line that error occurred in. It should ease the process a lot.

@sergiu-paraschiv
Copy link

sergiu-paraschiv commented Oct 11, 2016

The first thing I found was that with livereactreload enabled babelify generates a separate sourceMapUrl for each module instead of a big one at the end of the bundle.
Debugging this a bit I found that the source maps are not relative to my app folder.
Quick fix is --sourceMapsAbsolute but I think there's something bigger I'm missing here and the only direction I can go with debugging from here is watchify's incremental builds.
Is livereactreload somehow messing with babelify so that it can't process all the code at once but instead does it a module at a time?

@EugeneZ
Copy link
Contributor

EugeneZ commented Nov 24, 2016

I submitted PR #138 to resolve this. It's mostly working but there are two unresolved issues I could use some feedback on if anyone's interested. Details in the PR.

@sassanh
Copy link

sassanh commented Nov 24, 2016

@EugeneZ does it solve the line number problem too? or just duplicate filenames?

@EugeneZ
Copy link
Contributor

EugeneZ commented Nov 24, 2016

@sassanh Both! And also adds accurate sourcemaps when changed modules are loaded.

@sassanh
Copy link

sassanh commented Nov 24, 2016

@EugeneZ great, it seems to be working for me.

milankinen added a commit that referenced this issue Nov 25, 2016
@milankinen
Copy link
Owner Author

milankinen commented Nov 25, 2016

Fixed in version 3.1.1 🎉 🎉

Big applauses to @EugeneZ!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants