-
Notifications
You must be signed in to change notification settings - Fork 809
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
[2.x] Generate Sourcemaps for Development Environment #510
[2.x] Generate Sourcemaps for Development Environment #510
Conversation
Thanks @slavarazum |
Rails 6 ships source maps in production by default: rails/webpacker#769 (comment) I plan to let people decide what they want to do on their own. |
Ok, if source maps in production is a controversial question, but we always really need it in development the same as we have Probably the most thankless job I've ever done is contributing to Laravel. @driesvints Thanks for understanding my point. |
Tbvh it's still an opinionated topic. One could argue that everything's reverse engineer-able, even compiled assets. In that regard your front-end source code is always publicly available and the issue of uploading source maps is a non issue. I personally lean more to not including them in production after your thorough explanation of the topic but that doesn't mean my or your way needs to be the default. The files published here are owned by the app maintainer and can be modified however they see fit. Ultimately it's up to Taylor to decide if he wants to merge this or not, or any maintainer for any OS project for that matter. That's how open source works. Besides, Taylor linked to a comment from @dhh that clearly explains his views on this. |
@dhh told that view our source code in production it's pay tribute to the web in this fashion. Can we said that at the same point we always should open source our backend code? I know that front-end source code is always publicly available, and we could argue that everything's reverse engineer-able, but again it's discussion about source maps in production, my PR enables source maps only in development! And I also know that files like |
I don't think you understand how open source works if you expect that a maintainer should always agree to outsider's opinions and merge things they don't want in the code they have to maintain. Taylor has a different opinion than yours and decided not to merge your PR. That's his right as the maintainer of this project. This does't has anything to do with "useful defaults" or "deligating work to the community". |
If you reread my message, you will understand that it has nothing similar with "always agree to contributors". |
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