demo icon indicating copy to clipboard operation
demo copied to clipboard

assets are not loading after installation

Open Hodzinek opened this issue 1 year ago • 5 comments

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

Hodzinek avatar Feb 19 '24 17:02 Hodzinek

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

davidhoelzel avatar Feb 20 '24 11:02 davidhoelzel

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

javiereguiluz avatar Feb 20 '24 11:02 javiereguiluz

I tried again, and when I choose to run:

  1. $ symfony serve
  • it works perfectly
  1. $ php -S localhost:8002 -t public/
  • the symfony demo does not work - the problem with assets as described Just to clarify the issues...

Hodzinek avatar Feb 20 '24 14:02 Hodzinek

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) ?

UtechtDustin avatar Mar 02 '24 23:03 UtechtDustin

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.

morrisonlevi avatar May 22 '24 15:05 morrisonlevi