(Webpack) Why is versioning disabled in dev by default? #44161
-
I'm new to Symfony (and to Webpack Encore). After the first trivial edit to my css file, I ran into a stupid problem: I rebuilt the compiled CSS, opened my app in my browser served from Symfony's local server, and the css file that I was seeing was the unedited old one. After checking that I hadn't forgot to rebuild the css, I cleared the broswer's cache and the edits came online. I looked up how you enabled versioning, went to edit webpack.config.js to enable versioning thinking to myself "Isn't it a bit stupid that it's not enabled by default? Whatever, maybe this is part of the 'start small' phylosophy..." and then found this:
So, it's not like it's not enabled by default. It's purposefully enabled only on Production by default. Before I report this as a bug, what is the reasoning behind that that I might be missing? Why would you expect to not need versioning in development? What part of a good, best-practice development workflow am I not applying that would make versioning not necessary in development? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hey @php4fan! Hmm, the line in question in webpack.config.js was probably code that I originally created. I think the reason it wasn't enable on production are historical, and really don't apply anymore. In the first version of Encore, there was no Anyways, now that you effectively NEED to use |
Beta Was this translation helpful? Give feedback.
Hey @php4fan!
Hmm, the line in question in webpack.config.js was probably code that I originally created. I think the reason it wasn't enable on production are historical, and really don't apply anymore.
In the first version of Encore, there was no
encore_entry_script_tags()
. Instead, you just added<script src="{{ asset('build/app.js')">
to your template. In this situation, versioning only worked if you had yourjson_manifest_path
configured correctly... which you probably did, but we didn't have any guarantee. And since versioning was the ONLY feature that truly required you to have this setup correctly, we made it an "extra" feature for production (we may even have commented it out ori…