symfony / demo

Symfony Demo Application
https://symfony.com/
MIT License
2.46k stars 1.61k forks source link

assets are not loading after installation #1500

Open Hodzinek opened 6 months ago

Hodzinek commented 6 months ago

Tried all the possibilities to install Symfony Demo (with symfony and composer) but when start Symfony Demo website, assets are not loaded.

Snímek obrazovky 2024-02-19 v 18 54 50
davidhoelzel commented 6 months ago

Seems like there is some syntax error in a "content.js" in your code.

But the sourcemaps error is apparent upon every fresh installation of the demo.

Sources get loaded, but sourcemaps are not. This is a little bit annoying as there are dozens attempted to be loaded (from the vendor folder in project-root) and slow down local performance. As the sass-bundle always creates the compiled css with flag "--embed-source-map" when debug is enabled, there is no way to get rid of these errors but disabling debug. But then you will run into another issue: the sourcemap is nevertheless embedded with "app.output.css.map", which can also not be found and results in another 404. But at least you can still use your scss without dozens of sourcemap errors.

scss compiled with debug disabled: grafik

default sass-bundle build (debug enabled): grafik

javiereguiluz commented 6 months ago

We don't have any content.js asset in this project, right? If this is correct, maybe this comes from some browser extension?

Hodzinek commented 6 months ago

I tried again, and when I choose to run: 1) $ symfony serve

UtechtDustin commented 6 months ago

I can reproduce it with php -S localhost:8000 -t public, but works fine with php -S localhost:8000 public/index.php.
I'm not an expert for the build in php server (I'm using the symfony cli for dev), but i guess we have to pass the index.php as "router" script ?

But should the demo still "supports" the build in php server, as it was removed from the symfony documentation since 3.4 (https://github.com/symfony/symfony-docs/pull/11567) ?

morrisonlevi commented 3 months ago

This is how I set this up now:

composer create-project symfony/symfony-demo==2.5.1 symfony-demo
echo "APP_ENV=prod" > symfony-demo/.env.local
cd symfony-demo
composer install
php bin/console asset-map:compile

Hopefully that helps someone. the key is php bin/console asset-map:compile, which I got from the asset mapper documentation.