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

NodeJS source-map using source-map-support #397

Closed
bkniffler opened this issue Feb 14, 2017 · 7 comments
Closed

NodeJS source-map using source-map-support #397

bkniffler opened this issue Feb 14, 2017 · 7 comments

Comments

@bkniffler
Copy link

Hey,
currently source-maps of server main.js are not being used by nodejs. Maybe you guys could try and use https://www.npmjs.com/package/source-map-support to fix that?

@bkniffler
Copy link
Author

Btw. this can easily be done by adding the following plugin to server config (since it needs to be included in the server entry point):

new webpack.BannerPlugin('require("source-map-support").install();', {raw: true,entryOnly: false})

@delambo
Copy link
Member

delambo commented Feb 16, 2017

Thanks for reporting this @bkniffler. Can you give us an example of what you're fixing here. A pull request would be welcome too.

@bkniffler
Copy link
Author

If there is an error on the server side, the stack-traces will refer to the compiled main.js file since nodejs is not able to pickup the source map, hence refer the original code. https://www.npmjs.com/package/source-map-support is fixing this.

@tizmagik
Copy link
Contributor

The BannerPlugin would put it at the top of every file. Is that what we need or do we just need it at the top of the server entry file? ({entryOnly: true})

@delambo
Copy link
Member

delambo commented Feb 16, 2017

@bkniffler - I had to use the new one-argument options method and define banner to get this to work:

new webpack.BannerPlugin({ banner: 'require("source-map-support").install();', raw: true, entryOnly: false }),

@delambo
Copy link
Member

delambo commented Feb 16, 2017

Also, I'm testing this against errors in our internal app and it's not really adding anything. I'm adding throw 'error' in random places around the code and I get stack traces with or without this change. What use cases did you find that this addition fixed?

@delambo
Copy link
Member

delambo commented Feb 16, 2017

@bkniffler - Nevermind. I forgot that we were using source-map-support in our internal app so I was able to get a good use case 🙄

@delambo delambo closed this as completed Feb 23, 2017
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

3 participants