Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-Authored-By: Kocal <kocal@live.fr>
  • Loading branch information
Lyrkan and Kocal committed Mar 6, 2019
1 parent c02322c commit 71fd3b7
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions frontend/encore/advanced-config.rst
Original file line number Diff line number Diff line change
Expand Up @@ -149,25 +149,25 @@ normally use from the command-line interface:
Having the full control on Loaders Rules
----------------------------------------

The method ``configureLoaderRule()`` provide a clean way to configure Webpack loaders rules (``module.rules``, see `Configuration <https://webpack.js.org/concepts/loaders/#configuration>`_).
The method ``configureLoaderRule()`` provides a clean way to configure Webpack loaders rules (``module.rules``, see `Configuration <https://webpack.js.org/concepts/loaders/#configuration>`_).

This is a low-level method. Any of your modifications will be applied just before pushing the loaders rules to Webpack.
It means that you can override configuration provided by Encore, so maybe you will break things. Be careful when using it.
This is a low-level method. All your modifications will be applied just before pushing the loaders rules to Webpack.
It means that you can override the default configuration provided by Encore, which may break things. Be careful when using it.

A useful usage would be for configuring the ``eslint-loader`` to lint Vue files too.
The following code is equivalent:

.. code-block:: javascript
// Before
// Manually
const webpackConfig = Encore.getWebpackConfig();
const eslintLoader = webpackConfig.module.rules.find(rule => rule.loader === 'eslint-loader');
eslintLoader.test = /\.(jsx?|vue)$/;
return webpackConfig;
// After
// Using Encore.configureLoaderRule()
Encore.configureLoaderRule('eslint', loaderRule => {
loaderRule.test = /\.(jsx?|vue)$/
});
Expand Down

0 comments on commit 71fd3b7

Please sign in to comment.