File tree Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Expand file tree Collapse file tree 1 file changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -51,6 +51,22 @@ Next, install a package to help Svelte:
51
51
That's it! Any files inside ``assets/svelte/controllers/ `` can now be rendered as
52
52
Svelte components.
53
53
54
+ If you are using Svelte 4, you will have to add ``browser ``, ``import `` and ``svelte ``
55
+ to the ``conditionNames `` array. This is necessary as per `the Svelte 4 migration guide `_
56
+ for bundlers such as webpack, to ensure that lifecycle callbacks are internally invoked.
57
+
58
+ To modify the ``conditionNames `` array, append the following changes to the bottom
59
+ of your ``webpack.config.js `` file:
60
+
61
+ .. code-block :: javascript
62
+
63
+ // webpack.config.js
64
+
65
+ // module.exports = Encore.getWebpackConfig();
66
+ const config = Encore .getWebpackConfig ();
67
+ config .resolve .conditionNames = [' browser' , ' import' , ' svelte' ];
68
+ module .exports = config;
69
+
54
70
Usage
55
71
-----
56
72
@@ -146,3 +162,4 @@ https://symfony.com/doc/current/contributing/code/bc.html
146
162
.. _`Svelte` : https://svelte.dev/
147
163
.. _`the Symfony UX initiative` : https://symfony.com/ux
148
164
.. _StimulusBundle configured in your app : https://symfony.com/bundles/StimulusBundle/current/index.html
165
+ .. _the Svelte 4 migration guide : https://svelte.dev/docs/v4-migration-guide#browser-conditions-for-bundlers
You can’t perform that action at this time.
0 commit comments