Skip to content

Commit 4e7663f

Browse files
committed
feature symfony#13664 [WCM] Adding info about Vue build (weaverryan)
This PR was merged into the 5.0 branch. Discussion ---------- [WCM] Adding info about Vue build Docs for symfony/webpack-encore#769 Commits ------- e7bff3f adding info about Vue build
2 parents 74d20fe + e7bff3f commit 4e7663f

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

frontend/encore/vuejs.rst

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,38 @@ Any ``.vue`` files that you require will be processed correctly. You can also
2323
configure the `vue-loader options`_ by passing an options callback to
2424
``enableVueLoader()``. See the `Encore's index.js file`_ for detailed documentation.
2525

26+
Runtime Compiler Build
27+
----------------------
28+
29+
By default, Encore uses a Vue "build" that allows you to compile templates at
30+
runtime. This means that you *can* do either of these:
31+
32+
.. code-block:: javascript
33+
34+
new Vue({
35+
template: '<div>{{ hi }}</div>'
36+
})
37+
38+
new Vue({
39+
el: '#app', // where <div id="app"> in your DOM contains the Vue template
40+
});
41+
42+
If you do *not* need this functionality (e.g. you use single file components),
43+
then you can tell Encore to create a *smaller* and CSP-compliant build:
44+
45+
.. code-block:: javascript
46+
47+
// webpack.config.js
48+
// ...
49+
50+
Encore
51+
// ...
52+
53+
.enableVueLoader(() => {}, { runtimeCompilerBuild: false })
54+
;
55+
56+
You can also silence the recommendation by passing ``runtimeCompilerBuild: true``.
57+
2658
Hot Module Replacement (HMR)
2759
----------------------------
2860

0 commit comments

Comments
 (0)