Skip to content

Commit 61502dc

Browse files
committed
minor #22153 [WebpackEncore] Minor updates (Kocal)
This PR was merged into the 6.4 branch. Discussion ---------- [WebpackEncore] Minor updates I asked Claude Opus 4.6 to see what could changed in Encore documentation, since she has been somewhat forgotten for a while... 😅 Commits ------- d505c96 [WebpackEncore] Minor updates
2 parents 95b729f + d505c96 commit 61502dc

5 files changed

Lines changed: 35 additions & 14 deletions

File tree

frontend/encore/advanced-config.rst

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ normally use from the command-line interface:
268268
Encore.configureRuntimeEnvironment('dev-server', {
269269
// Same options you would use with the
270270
// CLI utility, with their name in camelCase.
271-
https: true,
271+
serverType: 'https',
272272
keepPublicPath: true,
273273
});
274274
@@ -280,22 +280,19 @@ The method ``configureLoaderRule()`` provides a clean way to configure Webpack l
280280
This is a low-level method. All your modifications will be applied just before pushing the loaders rules to Webpack.
281281
It means that you can override the default configuration provided by Encore, which may break things. Be careful when using it.
282282

283-
One use might be to configure the ``eslint-loader`` to lint Vue files too.
284-
The following code is equivalent:
283+
For example, you could use it to configure the ``vue`` loader to enable a specific option:
285284

286285
.. code-block:: javascript
287286
288287
// Manually
289288
const webpackConfig = Encore.getWebpackConfig();
290289
291-
const eslintLoader = webpackConfig.module.rules.find(rule => rule.loader === 'eslint-loader');
292-
eslintLoader.test = /\.(jsx?|vue)$/;
293-
294-
return webpackConfig;
290+
const vueLoader = webpackConfig.module.rules.find(rule => /vue-loader/.test(rule.loader);
291+
vueLoader.options.experimentalInlineMatchResource = true;
295292
296293
// Using Encore.configureLoaderRule()
297-
Encore.configureLoaderRule('eslint', loaderRule => {
298-
loaderRule.test = /\.(jsx?|vue)$/
294+
Encore.configureLoaderRule('vue', loaderRule => {
295+
loaderRule.options.experimentalInlineMatchResource = true;
299296
});
300297
301298
return Encore.getWebpackConfig();
@@ -310,7 +307,6 @@ The following loaders are configurable with ``configureLoaderRule()``:
310307
- ``stylus``
311308
- ``svelte``
312309
- ``vue``
313-
- ``eslint``
314310
- ``typescript`` (alias ``ts``)
315311
- ``handlebars``
316312

frontend/encore/css-preprocessors.rst

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,31 @@ Encore, you're done!
3030
You can also pass configuration options to each of the loaders. See the
3131
`Encore's index.js file`_ for detailed documentation.
3232

33+
.. tip::
34+
35+
Since Encore 6.0, ``sass-loader`` uses the `modern Sass API`_ by default.
36+
This means that some options have changed. For example, ``includePaths`` is
37+
now ``loadPaths``:
38+
39+
.. code-block:: javascript
40+
41+
// webpack.config.js
42+
// ...
43+
44+
Encore
45+
// ...
46+
47+
// with the modern API (default):
48+
.enableSassLoader((options) => {
49+
options.loadPaths = [/* ... */];
50+
})
51+
52+
// if you need the legacy API (not recommended):
53+
.enableSassLoader((options) => {
54+
options.api = 'legacy';
55+
options.includePaths = [/* ... */];
56+
})
57+
;
58+
3359
.. _`Encore's index.js file`: https://github.com/symfony/webpack-encore/blob/master/index.js
60+
.. _`modern Sass API`: https://sass-lang.com/documentation/js-api/interfaces/options

frontend/encore/dev-server.rst

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,8 +100,6 @@ the following option:
100100
101101
.configureDevServerOptions(options => {
102102
options.allowedHosts = 'all';
103-
// in older Webpack Dev Server versions, use this option instead:
104-
// options.firewall = false;
105103
})
106104
107105
Beware that this is not a recommended security practice in general, but here

frontend/encore/simple-example.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ you need a feature, Encore will tell you what you need to install. Run:
425425

426426
.. code-block:: terminal
427427
428-
$ npm install sass-loader@^13.0.0 sass --save-dev
428+
$ npm install sass-loader@^16.0.0 sass --save-dev
429429
$ npm run watch
430430
431431
Your app now supports Sass. Encore also supports LESS and Stylus. See

frontend/encore/vuejs.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Next, run or restart Encore. When you do, you will see an error message helping
106106
you install any missing dependencies. After running that command and restarting
107107
Encore, you're done!
108108

109-
Your ``.jsx`` files will now be transformed through ``@vue/babel-preset-jsx``.
109+
Your ``.jsx`` files will now be transformed through ``@vue/babel-plugin-jsx``.
110110

111111
Using styles
112112
~~~~~~~~~~~~

0 commit comments

Comments
 (0)