Skip to content

Commit f1ac0b1

Browse files
committed
minor #16207 Add information about strict_mode for encore (Philosoft)
This PR was submitted for the 6.0 branch but it was squashed and merged into the 5.4 branch instead. Discussion ---------- Add information about strict_mode for encore I guess it should be both in `5.4` and `6.0`, but actually will be useful down to whenever symfony/webpack-encore-bundle#54 was merged Personally, it took me quite a long time to determine and fix the cause of functional tests failing in CI. I know that stuff is kind of mentioned in `config/packages/webpack_encore.yaml`, but here are my excuses * there is certain time gap between you first install webpack, write your functional tests (involved with actual HTML rendering), add some styles/scripts to template and setup CI to run these tests * this stuff is not mentioned in the docs at all - `fgrep -RH strict_mode .` gives 0 results Commits ------- 2b6371f Add information about strict_mode for encore
2 parents 2aeff1b + 2b6371f commit f1ac0b1

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

frontend/encore/faq.rst

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -169,3 +169,24 @@ running it (e.g. when executing ``yarn encore dev``). Fix this issue calling to
169169
// ... the rest of the Encore configuration
170170
171171
.. _`Webpack integration in PhpStorm`: https://www.jetbrains.com/help/phpstorm/using-webpack.html
172+
173+
My functional tests are failing in CI
174+
-------------------------------------
175+
176+
With something along the lines of
177+
178+
.. code-block:: text
179+
180+
Uncaught PHP Exception Twig\Error\RuntimeError: "An exception has been thrown during the rendering of a template ("Could not find the entrypoints file from Webpack: the file "/var/www/html/public/build/entrypoints.json" does not exist.
181+
182+
..
183+
184+
This is happening because you did not build your encore assets, hence no ``entrypoints.json`` file. Plus encore is working in strict mode by default, which causes twig functions ``encore_entry_*`` to panic.
185+
186+
To solve that you can add this to your ``config/packages/test/webpack_encore.yaml``
187+
188+
.. code-block:: yaml
189+
190+
webpack_encore:
191+
strict_mode: false
192+
..

0 commit comments

Comments
 (0)