[2.x] Generate Sourcemaps for Development Environment #510
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Sourcemaps should be provided preferably for development environment to provide appropriate debugging experience.
In general, we shouldn't generate it and host on production because of 2 reasons:
As a point you can check out Bugsnag docs which recommend uploading source maps directly to service - Uploading Source Maps and not recommends hosting them.
I see only one reason to host sourcemaps temporarily in production - debug a complex issue that appears only in production mode.
Sourcemaps needs not only for minified assets but for every build where debugging needs.
This is development build without sourcemaps:
It has only final
app.js
file which isn't minified, but totally not readable and debuggable because it has transpiled by webpack.This is development build with sourcemaps:
It has
webpack
andwebpack-internals
directories which has our application source code structure with all components and JavaScript files where we can place breakpoints, evaluate expressions and other debugging purposes.Conclusion:
We always should generate sourcemaps in development environment to provide appropriate debugging experience and usually shouldn't generate it in production.
P.S.: @taylorotwell, take a look into original discussion with @driesvints - #502