Home > OS >  why webpack/encore symfony adds public/build in gitignore?
why webpack/encore symfony adds public/build in gitignore?

Time:11-03

I have webpack/encore installed on my symfony project.

public/build has been added to gitignore but when I deploy on a PaaS like platform.sh, without this folder, my website design is broken.

Should I remove public/build folder from gitignore ?

Thanks in advance.

CodePudding user response:

Platform.sh is designed to have first-class support for your git workflow. So, I'm sure if you added .gitignore it was for a good reason.

Wherever your app is defined (.platform.app.yaml or .platform/applications.yaml) you will want to:

  1. Ensure your build hoook is generating your public/build assets.
  2. That your locations and root is properly configured to handle requests made to your app so that request to your website are handled appropriately.

With this in place, from your local machine (and after deployment) run platform ssh and check to make sure your public/build files exist.

CodePudding user response:

Don't remove the ignore because you must install and build the assets in your server.

You must first install all dependences and then build your assets. In your root document add this file .platform.app.yaml

//.platform.app.yaml
name: node-app
type: nodejs:16
disk: 512

dependencies:
    nodejs:
        yarn: "*"

hooks:
    build: |
        npm install --force
        npm run build  
  • Related