简体   繁体   中英

Symfony 4 - Heroku - Can't use my images (webpack-encore)

in my project symfony 4 I use all kinds of images.

I have static images for the decoration of the site. I put them in assets/images , and I generated them in the public/build/images with webpack-encore .

And these pictures, I manage their size with LiipImagineBundle

So I deployed my project on Heroku. It installs the bundles , the node_modules , generates the files with webpack-encore from the assets , and generates the database

composer.json:

"compile": [
      "php bin/console doctrine:schema:drop --full-database --force --env=prod",
      "php bin/console d:m:m",
      "php bin/console d:f:l --no-interaction --env=PROD"
    ]

package.json:

"scripts": {
        "dev-server": "encore dev-server",
        "dev": "encore dev",
        "watch": "encore dev --watch",
        "build": "encore production --progress",
        "heroku-postbuild": "node_modules/.bin/encore production"
    },

However when I go on the application from Heroku, the site works but the images that must be displayed through LiipImagineBundle are not. Instead I have a 500 error telling me that resources do not exist. And actually if I go in the section "Sources", in the public / build / images, there are missing images. Yet they must be generated because in local (in dev), everything works perfectly.

All my required bundle for prod are in " require " and not " require-dev ". And I haven't devDependencies in my package.json , all is in ' depedencies '

Has anyone ever had the same problem?

You can used heroku-buildpack

It uses Composer for dependency management, supports PHP or HHVM (experimental) as runtimes, and offers a choice of Apache2 or Nginx web servers.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM