symfony / webpack-encore-bundle

Symfony integration with Webpack Encore!
https://symfony.com/webpack-encore
MIT License
939 stars 83 forks source link

webpack-encore not working correctly in a live server #235

Open ybico opened 1 year ago

ybico commented 1 year ago

After deploying only the build folder on my live website, the following tags:

{{ encore_entry_link_tags('app') }} and {{ encore_entry_script_tags('app') }}

no longer work. So, for the moment, I am using the previous tags:

<link rel="stylesheet" href="{{ active('build/app.573ca45c.css') }}"> and <script src="{{ active('build/app .2d1f7652.js') }}"></script>

which are a momentary ugly solution, pointing directly to the hashed files, because it does not catch the links provided by the manifest.json file either. I have the manifest.json and entrypoints.json files successfully built, but the magic of webpack encore is gone on the live server.

// manifest.json { "build/app.css": "/build/app.573ca45c.css", "build/app.js": "/build/app.2d1f7652.js", "build/runtime.js": "/build/runtime.600ac592.js", "build/386.09d9c820.css": "/build/386.09d9c820.css", "build/386.92a54516.js": "/build/386.92a54516.js", "build/images/fontawesome-webfont.svg?v=4.7.0": "/build/images/fontawesome-webfont.c1e38fd9.svg", "build/fonts/fontawesome-webfont.eot": "/build/fonts/fontawesome-webfont.8b43027f.eot", "build/fonts/fontawesome-webfont.ttf?v=4.7.0": "/build/fonts/fontawesome-webfont.1e59d233.ttf", "build/fonts/fontawesome-webfont.woff?v=4.7.0": "/build/fonts/fontawesome-webfont.f691f37e.woff", "build/fonts/fontawesome-webfont.woff2?v=4.7.0": "/build/fonts/fontawesome-webfont.20fd1704.woff2", "build/images/rwbag.png": "/build/images/rwbag.0105f3ae.png", "build/images/ivanvino.png": "/build/images/ivanvino.95f81f89.png", "build/images/wine-icon.ico": "/build/images/wine-icon.f60a8ed2.ico", "build/images/symfony-logo.svg": "/build/images/symfony-logo.579acd4f.svg" }

// entrypoints.json { "entrypoints": { "app": { "js": [ "/build/runtime.600ac592.js", "/build/386.92a54516.js", "/build/app.2d1f7652.js" ], "css": [ "/build/386.09d9c820.css", "/build/app.573ca45c.css" ] } } }

My question is, why does webpack encore become faddy on a live web server or am I doing something wrong ? I will appreciate any help guiding me in this matter.

PS,

local machine: Ubuntu 20.04, PHP 8.1, Symfony 6.3, Symfony built-in server live server: Godaddy, linux hosting, PHP 8.1, Symfony 6.3