Skip to content

Vue.compile is not a function #3972

@melbayad

Description

@melbayad

I am using Vuejs 2 (webpack-simple template) and I would compile template before render it. Below my code :
App.vue

<template>
    <div id="app">
        <h1>{{ msg }}</h1>
    </div>
</template>
<script>
    export default {
        name: 'app'
    }
</script>

main.js

import Vue from 'vue'
import App from './App.vue'

const res = Vue.compile(App)
const vm = new Vue({
    el: '#app',
    data: {
        msg: 'hello'
    },
    render: res.render,
    staticRenderFns: res.staticRenderFns
})

But when I start the server I got this error : __WEBPACK_IMPORTED_MODULE_0_vue___default.a.compile is not a function . Can you please help me to make it work ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions