This is my first time using Webpack-Encore, and I am trying to load the entrypoints.json file from a non-default location on my local machine. I am using the Symfony server and the document root of the web server is 'public_html' rather than 'public', but I have been unable to configure Symfony to look into the 'public_html' folder for the entrypoints.json file.
The error I receive is: An exception has been thrown during the rendering of a template ("Could not find the entrypoints file from Webpack: the file "...\SoCalOfficials-api/public/build/entrypoints.json" does not exist."). However, the file does exist in "...\SoCalOfficials-api/public_html/build/entrypoints.json"
The Symfony server is started in the "...\SoCalOfficials-api" directory using the command:
symfony server:start --document-root=public_html
The framework.yaml file is as follows:
framework:
assets:
json_manifest_path: '%kernel.project_dir%/public_html/build/manifest.json'
The webpack.config.php file is as follows:
Encore
// directory where compiled assets will be stored
.setOutputPath('public_html/build/')
// public path used by the web server to access the output path
.setPublicPath('/build')
The webpack successfully builds and writes files 5 files to 'public_html\build'.
Since the server's document root is 'public_html' I expected Symfony/Twig to look in that directory for the manifest.json file instead of 'public'.
All of the answers that I've found to this type of question were resolved by installing @symfony\webpack-encore and doing a build. However, this already works for me.
I had same problem while deploying on shared hosting.
Turns out you have to change config in "config/packages/webpack_encore.yaml"
framework:
assets:
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
maybe also
webpack_encore:
output_path: '%kernel.project_dir%/public_html/build'
Now finally it's searching where it's supposed to!