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 maps would help debug some classes of problems #13

Open
canadaduane opened this issue Oct 28, 2020 · 5 comments
Open

Source maps would help debug some classes of problems #13

canadaduane opened this issue Oct 28, 2020 · 5 comments

Comments

@canadaduane
Copy link
Contributor

canadaduane commented Oct 28, 2020

Occasionally I do something dumb (ok, quite often) and end up in some code path that HECS didn't anticipate, throwing an error that is hard to debug.

For example:

image

image

Adding source maps to the dist/ folder would help here (maybe).

@ashconnell
Copy link
Collaborator

Yeah I haven't gotten around to it yet. Personally I don't run into this much because i've been using it for a long time and must know how to avoid it, but i understand people just picking HECS up are likely to stumble into this quite often.

I might be able to look at adding source maps in the next week or two, it's probably not too hard.

Do you have a snippet that reproduces an error like the one above?

@canadaduane
Copy link
Contributor Author

Do you have a snippet that reproduces an error like the one above?

Sure, here's my latest dumb mistake :)

Inside a System's update method:

const transform = entity.get(Transform);
transform.position.add(undefined)

@ashconnell
Copy link
Collaborator

These are the steps I took to create a reproduction:

  1. Edit the hecs-plugin-core package WorldTransformSystem and insert a throw new Error('LOL') into the update() function
  2. Run yarn build in hecs-plugin-core
  3. Run yarn start in hecs-example

This is what I see in the console:

image

(we're expecting to see minified code which is useless to us)

I then:

  1. Changed hecs-plugin-core webpack config to remove config.devtool = false
  2. Ran yarn build in hecs-plugin-core
  3. Refreshed the browser

This is what I see

image

All is good!

I also don't think we need to add the files change in this PR. By default, Npm deploys all files. If you run npm pack you can see what gets published and both src and dist are included already.

Just for brevity, I also double checked the source-maps are a separate file so as not to increase the bundle size.

@ashconnell
Copy link
Collaborator

@canadaduane if this works for you, lets remove the files change and then I can merge

@canadaduane
Copy link
Contributor Author

Ok, I can confirm this works in hecs-example. I'm unable to see sources in my own project, but I suspect this may be my own misconfiguration.

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

Successfully merging a pull request may close this issue.

2 participants