I'm getting the following error:
[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.
(found in <Root>)
package.json
"scripts": {
"watch": "parcel watch js/app.js --out-dir ../priv/static/js"
},
It should work
It doesn't work.
It returns the following error:
[Vue warn]: You are using the runtime-only build of Vue where the template compiler is not available. Either pre-compile the templates into render functions, or use the compiler-included build.
(found in <Root>)
| Software | Version(s) |
| ---------------- | ---------- |
| Parcel | Latest |
| Node | Latest |
| npm/Yarn | Latest |
| Operating System | Windows 10 |
Code samples would be helpfull as you鈥檙e probably doing something wrong or you鈥檙e running an outdated parcel
Sent with GitHawk
Hey, I have the same error, with:
| Software | Version |
|------------|---------|
| Parcel | 1.10.3 |
| Node | 8.10.0 |
| npm | 3.5.2 |
| babel-core | 6.26.3 |
index.html
<html>
<head>
</head>
<body>
<div id="app">
</div>
<script src='index.js'></script>
</body>
</html>
index.js
import Vue from 'vue'
import App from './src/App.vue'
const vm = new Vue({
el: '#app',
template: '<App/>',
components: { App },
})
src/App.vue
<template>
<p>
{{ message }}
</p>
</template>
<script>
export default {
data () {
return {
message: 'hello world'
}
}
}
</script>
I "solved" it, changing index.js to:
index.js
// import Vue from 'vue'
import Vue from 'vue/dist/vue.js'
import App from './src/App.vue'
const vm = new Vue({
el: '#app',
template: '<App/>',
components: { App },
})
However, from the vue docs:
Do NOT do import Vue from 'vue/dist/vue.js' - since some tools or 3rd party libraries may import vue as well, this may cause the app to load both the runtime and standalone builds at the same time and lead to errors.
Is there any other workarounds?
Thanks!
@matngo @Sjoerrdd hi there, the runtime-only build requires a render functions to be given, your initial Vue instance has no render function instead you're defining a raw template.
I explained how to do it in #2178
@Hammster Thanks for the answer, it worked perfectly for me!
Another option is to directly include the version with the template compiler in your code like this:
import Vue from 'vue/dist/vue.js';
However, you'll be getting the dev version in your build as well. So it's probably better to add this to your package.json
"alias": {
"vue": "./node_modules/vue/dist/vue.common.js"
}
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs.
Most helpful comment
Another option is to directly include the version with the template compiler in your code like this:
import Vue from 'vue/dist/vue.js';However, you'll be getting the dev version in your build as well. So it's probably better to add this to your
package.json