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

Use cheap-module-eval-source-map #4537

Closed
wants to merge 1 commit into from
Closed

Use cheap-module-eval-source-map #4537

wants to merge 1 commit into from

Conversation

noisysocks
Copy link
Member

@noisysocks noisysocks commented Jan 17, 2018

By sacrificing a small amount of source map accuracy, we make incremental development builds about 20% faster.

Learn about the different modes here: https://webpack.js.org/configuration/devtool/#devtool

About the trade-off

Say you have code like this:

const { foo, bar, baz } = coolObject;

With source-maps, DevTools will allow you to step through each operation within that line: first, the foo assignment, then the bar assignment, then the baz assignment.

With cheap-module-eval-source-map, DevTools will only allow you to break at that entire line.

In my experience, it’s not worth the performance penalty.

And besides, if one needs to step through things more granularly, they can temporarily change their Webpack settings and rebuild.

@noisysocks
Copy link
Member Author

I personally think the trade-off here is worth it, but happy to hear what @WordPress/gutenberg-core thinks 🙂

@gziolo
Copy link
Member

gziolo commented Jan 17, 2018

With source-maps, DevTools will allow you to step through each operation within that line: first, the foo assignment, then the bar assignment, then the baz assignment.

With cheap-module-eval-source-map, DevTools will only allow you to break at that entire line.

Should we document it somewhere in our docs?

@gziolo
Copy link
Member

gziolo commented Jan 17, 2018

I double checked how Calypso handles it:

devtool: isDevelopment ? '#eval' : process.env.SOURCEMAP || false, // in production builds you can specify a source-map via env var.

process.env.SOURCEMAP is also passed as param to uglify plugin:

sourceMap: Boolean( process.env.SOURCEMAP ),

@aduth
Copy link
Member

aduth commented Jan 17, 2018

Using breakpoints in Chrome DevTools quite frequently, I find that beyond what tends to be advertised in the source map option descriptions, Chrome is very particular about working well with some options over the other; often not creating or firing breakpoints, or not creating them where I'd expect. This is why I might be reluctant to make any changes here, though if it doesn't regress I'd be fine with the change.

To the actual difference: One more common case might be setting breakpoints at inline anonymous function callbacks, if that would be affected.

By sacrificing a small amount of source map accuracy, we make
incremental builds about 20% faster.

https://webpack.js.org/configuration/devtool/#devtool
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 this pull request may close these issues.

3 participants