Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 184575d

Browse filesBrowse files
committed
minor #10947 feat(encore): IDE Integration (Kocal)
This PR was merged into the 3.4 branch. Discussion ---------- feat(encore): IDE Integration This PR add a new entry in the FAQ page of Encore, which explains how to integrate Webpack/Encore in an IDE. Refs: symfony/webpack-encore#236 & symfony/webpack-encore#500 Ping @Lyrkan Let me know if I should modify things, thanks. Commits ------- d8ca065 feat(encore): ide integration
2 parents e5c0ee1 + d8ca065 commit 184575d
Copy full SHA for 184575d

File tree

Expand file treeCollapse file tree

1 file changed

+27
-0
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+27
-0
lines changed

‎frontend/encore/faq.rst

Copy file name to clipboardExpand all lines: frontend/encore/faq.rst
+27Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.