Skip to content

feat(encore): IDE Integration #10947

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Feb 1, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions frontend/encore/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -137,3 +137,30 @@ Babel. But, you can change that via the ``configureBabel()`` method. See
:doc:`/frontend/encore/babel` for details.

.. _`rsync`: https://rsync.samba.org/

How Do I Integrate my Webpack Configuration in my IDE?
------------------------------------------------------

Some IDE (like `PhpStorm <https://www.jetbrains.com/help/phpstorm/using-webpack.html>`_) can read and interpret your ``webpack.config.js`` file
to make your development easier (e.g.: aliases resolution).

However, you could face the following error:

.. code-block:: text

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.

It fails because Encore Runtime Environment is only configured when you are running it (e.g. ``yarn encore dev``).

To properly fix it, you should manually call ``Encore.isRuntimeEnvironmentConfigured()`` and ``Encore.configureRuntimeEnvironment()``:

.. code-block:: javascript

// webpack.config.js
const Encore = require('@symfony/webpack-encore')

if (!Encore.isRuntimeEnvironmentConfigured()) {
Encore.configureRuntimeEnvironment(process.env.NODE_ENV || 'dev');
}

// Normal Encore usage