Skip to content

Commit d8ca065

Browse files
committed
feat(encore): ide integration
1 parent da51a30 commit d8ca065

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

frontend/encore/faq.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,3 +137,30 @@ Babel. But, you can change that via the ``configureBabel()`` method. See
137137
:doc:`/frontend/encore/babel` for details.
138138

139139
.. _`rsync`: https://rsync.samba.org/
140+
141+
How Do I Integrate my Webpack Configuration in my IDE?
142+
------------------------------------------------------
143+
144+
Some IDE (like `PhpStorm <https://www.jetbrains.com/help/phpstorm/using-webpack.html>`_) can read and interpret your ``webpack.config.js`` file
145+
to make your development easier (e.g.: aliases resolution).
146+
147+
However, you could face the following error:
148+
149+
.. code-block:: text
150+
151+
Error details: Encore.setOutputPath() cannot be called yet because the runtime environment doesn't appear to be configured. Make sure you're using the encore executable or call Encore.configureRuntimeEnvironment() first if you're purposely not calling Encore directly.
152+
153+
It fails because Encore Runtime Environment is only configured when you are running it (e.g. ``yarn encore dev``).
154+
155+
To properly fix it, you should manually call ``Encore.isRuntimeEnvironmentConfigured()`` and ``Encore.configureRuntimeEnvironment()``:
156+
157+
.. code-block:: javascript
158+
159+
// webpack.config.js
160+
const Encore = require('@symfony/webpack-encore')
161+
162+
if (!Encore.isRuntimeEnvironmentConfigured()) {
163+
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
164+
}
165+
166+
// Normal Encore usage

0 commit comments

Comments
 (0)