Skip to content

Commit 3516c17

Browse files
committed
docs: add webapck alias requirement
1 parent ad7e3e0 commit 3516c17

File tree

1 file changed

+47
-0
lines changed

1 file changed

+47
-0
lines changed

README.md

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,53 @@ export default {
3535

3636
Check out the [demo](http://vue-live.surge.sh) for alternative syntaxes to write your showcases.
3737

38+
## Enabling template compilation
39+
40+
To compile templates in the browser, you need the compiler to be in your JS bundle.
41+
42+
If you do not, you might see errors about using the runtime version of Vue.
43+
44+
To bundle this, there is a simple solution: Add an alias in `webpack.config.js`.
45+
46+
```js
47+
module.export = {
48+
resolve: {
49+
alias: {
50+
// this enables loading the "full" version of vue
51+
// instead of only loading the vue runtime
52+
vue$: "vue/dist/vue.esm.js",
53+
},
54+
},
55+
};
56+
```
57+
58+
in [nuxt.config.js](https://nuxtjs.org/faq/extend-webpack/)
59+
60+
```js
61+
export default {
62+
build: {
63+
extend(config, { isDev, isClient }) {
64+
// ..
65+
config.resolve.alias.vue$ = "vue/dist/vue.esm.js";
66+
},
67+
},
68+
};
69+
```
70+
71+
and finally in [gridsome.config.js](https://gridsome.org/docs/config/#configurewebpack)
72+
73+
```js
74+
module.exports = {
75+
configureWebpack: {
76+
resolve: {
77+
alias: {
78+
vue$: "vue/dist/vue.esm.js",
79+
},
80+
},
81+
},
82+
};
83+
```
84+
3885
## How to contribute
3986

4087
```sh

0 commit comments

Comments
 (0)